Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

(Ebook - Pdf) Kick Ass Delphi Programming

.pdf
Скачиваний:
284
Добавлен:
17.08.2013
Размер:
5.02 Mб
Скачать

testing parsing, 22 Command line tools

filters. See Filter programs. Components, 99

advantages, 100

building TCP/IP networking, 101 color combobox, 228

creating for http, 100 defining tasks, 241 font property, 423

interfacing with winsock api, 100 outline, 297

receiver, 455

relationship of sender and receiver, 455 sender, 455

source code for tsplash dialogue, 368 splash screen, 365

tdbstatistics. See TDBStatistics. testing while under construction, 367 tform, 365

timage, 368 tree view, 297 trztrackbar, 224 Wsock, 100 comptostr, 194

Console applications API functions, 9 creating, 6 defined, 4

hello world example, 6 I/O functions, 8

in Delphi, 5 input, 8 output, 8

peekconsoleinput, 9 project1.dpr, 6

text file I/O routines, 9 uses statement, 7 Windows vs. DOS, 4 writeconsole, 9

Constructors

create, 190

Controls

adjusting a single font, 276 adjusting fonts, 276 custom, 52

disabling individual radio buttons, 206 moving, 264

releasecapture, 264 resizing, 267 tradiogroup, 207 twincontrol, 265 wm_syscommand, 265

CreateFileMapping, 468

CreateToolHelp32Snapshot, 389

handle, 389 mask, 389

D

Data Access palette, 377

Data Modules, 377

defined, 377 example, 378

example at runtime, 380 Databases, 287

hierarchical, 288 network, 288 relational, 288 tree hierarchy, 287

VCL object hierarchy, 287 dBASE

dbipacktable command, 336 deleting excess space in tables, 332 deleting records vs. paradox, 336 using bde routines to pack, 333

Destroy destructor, 488

DLLProc variable, 93

reason parameter, 93 DLLs, 455

accessing a form, 83 and Win95 library, 470

building, 74 calling, 75

calling a function, 73 cautions, 82 creating, 75

creating forms, 83 defined, 72 designing, 458 disadvantages, 82 DLLproc variable, 93 DLLvalid, 478 dynamically, 74

exports statement, 75, 85 firstreceiverassigned, 478

for sender/receiver component support, 459 format conversion interface, 86

global memory handles, 96 implementation, 80

index clause, 76 library, 74

linking at runtime, 77 memory files, 468 msgreceiver, 480

multiple instances and shared memory, 469 name clause, 76

nextreceiverassigned, 478 openfile fuction, 92

problems with static linkage, 77 routines, 471

runtime dynamic linking, 77

runtime dynamic linking example, 77 semaphores, 469

setting up shared memory blocks, 93

several instances running simultaneously, 468 sharing memory between applications, 93 startup code, 467

static linkage example, 76 statically linking, 73 stdcall, 75

text editor example, 86

to store forms, 83 uses statement, 74 using a form, 85 vs. units, 72

where Windows looks, 81 DOS applications

API functions, 9 creating, 6 defined, 4

filter programs, 10 hello world example, 6 I/O functions, 8

in Delphi, 5 input, 8 output, 8

peekconsoleinput, 9 PROJECT1.DPR, 6

TEXT FILE I/O routines, 9 uses statement, 7 Windows vs. DOS, 4 writeconsole, 9

DOS extenders, 4

Drag and Drop, 324

accept parameter, 327 acceptability of a drop, 328 begindrag method, 324, 327 calandar example, 325

calculating the position of a drop, 328 draggable outline, 195

dragging, 412 drawfocusrect, 198 interface. See FMDD.

interfaces supported by Delphi, 39 mousedown, 198

mousemove, 198 mouseup, 198 ondragdrop event, 325 ondragend event, 325 ondragover event, 324 outlnlbx.pas, 196

sender, 327 server, 67

signifying to the user, 195 source, 327

state, 327

to do list example, 412

using an event handler to begin a drag, 326 DragDrop event handler, 329

DropGridString, 424

Dynamic Link Library. See DLLs.

E

Environment detector, 431

Event handlers

application.onmessage, 50 creating routine names, 413 dragdrop, 329

handled variable, 347 onclick, 384 oncreate, 423 ondragdrop, 413 ondragover, 327, 413 onmessage, 50

onmousedown, 326, 423, 439 onmousemove, 439

onresize, 363 sharing, 413

Events

creating different descriptions, 342 FONID Message, 458 formclosequery, 281

OnCalc, 378 OnDragDrop, 325 OnDragEnd, 325 OnDragOver, 324 OnIdle, 220 OnMessage, 343 OnMouseDown, 326 shared example, 412 sharing, 412

F

File Mananger Drag and Drop. See FMDD. File Transfer Protocol. See FTP.

Filter programs, 4

as console apps, 10

command line. See Command line. creating a template, 34

defined, 4, 10 file I/O, 26 tfilterfile, 27

tfilterfile in place of standard I/O 32 translating from upper to lower case, 26

FinalizeLibrary, 470

FMDD, 40

acceptdroppedfiles, 46 custom controls, 52 defining interfaces, 54 drag and drop server, 67 dragacceptfiles, 40 dragfinish, 40 dragfrm1.pas, 41 dragfrm3.pas, 64 dragqueryfile, 40 dragquerypoint, 40

encapsulating drag and drop interface, 47 getdroppedfiles, 46

handling Windows code, 46 implementation in Windows, 40 implementing interfaces, 56 multiple controls, 57

responding to Windows messages, 50 shell32.dll, 40

unacceptdroppedfiles, 46 wm_dropfiles, 40

Font property, 423 height, 423

FontHeight, 423

ForEach iterators, 198

FormCloseQuery event, 281

Forms, 358

alignment property, 362 arranging components, 362 bevelouter properties, 363 creating in dlls, 83

data modules. See Data Modules OnClick event handler, 384 OnCreate handler, 423 OnResize event handler, 363 resizing, 358

resizing example, 359 SCRNCAP.PAS, 205 tag property, 384

taking a snapshot of the entire form, 204 FTP, 133

change procedure, 138 client application, 139

client server communication, 134 control connection, 134

decode, 149 defined, 133

displaying output, 137 ftpcli, 138 ftpcommand, 137 logfile, 153

login sequence, 135 logon, 153

retrieving a directory listing, 149 shopper, 133, 136

tcp port number 21, 134 uploading a file, 152 user commmand, 135

wsock vcl component, 136

G

GetLocalModuleList, 398

GetProcessModules, 398

GetSystemModuleList, 398, 399

GetSystemProcessList, 398

GetTextMetrics, 423

H

Handled variable, 347

Handlers

wm_getminmaxinfo, 359 Hierarchical data

arbitrary nesting, 303 circular references, 302 displaying data, 296

identifying and locating items, 300 master-detail relationship, 289-290 navigating, 294

nested recursive, 293 outline component, 297 parent rows, 290 queries, 300

referential integrity, 302 simple recursive, 289

SQL to bridge generations, 302 SQL to search lineage, 300 stored procedures, 304

Tree View component, 297

TreeData combobox, 309

TreeData component internals, 308

TreeData components, 306

TreeData listbox, 310

TreeData properties, 307

TreeDataOutline, 310

TreeDataUpdate, 310

TreeUtil.pas, 308

user interfaces, 298

I

Image Editor, 478-479

creating a resource file, 478 IParam, 359

K

Keystrokes

filtering, 343

swapping, 344 translating, 343

L

LaserFrm, 211

Listings

1.1(Hello, Delphi program), 6-7

1.2(Params program), 11-12

1.3(CmdLine unit), 15-20

1. 4 (Testing the CmdLine unit), 22-23

1.5(Filter project file), 24

1.6(FILTMAIN), 24-25

1.7(Translating character case), 26-27

1.8(TFilterFile class), 28-32

1.9(TFilterFile in place of standard I/O), 32-34

2.1(DRAG1.DPR), 41

2.2(DRAGFRM1.PAS), 41-44

2.3(FMDD unit), 47-49

2.4(Using the File Manager Drag and Drop Interface), 49-50

2.5(TFMDDForm custom component), 52-53

2.6(Interface section of FMDD), 55-56

2.7(FMDD unit to support multiple controls), 57-63

2.8(DRAGFRM3.PAS), 64-65

3.1(Simple DLL), 74

3.2(BEEPER DLL interface), 76

3.3(Dynamically linking a DLL), 77-79

3.4(PICKCLR.DPR), 84

3.5(COLORFRM.PAS), 84-85

3.6(EDITFORM.PAS), 86-88

3.7(TEXTEDIT.INI), 89

3.8(OpenFile function), 89-91

3.9(TEXTCONV.DPR), 91-

3.10(TEXTC.PAS), 92

3.11(Implementing shared memory in a DLL), 94-95

4.1(TWSocket definition), 101-108

4.2(TWSocket.Create constructor), 109

4.3(TWSocket.Startup function), 110

4.4(TWSocket.CleanUp procedure), 110-111

4.5(FormCreate procedure), 112-113

4.6(GetLocalName function, 114

4.7(Mapping a host name to its Internet address), 115-116

4.8(Resolving a host name), 119-120

4.9(AsyncOperation procedure), 121-123

4.10(Canceling an asynchronous operation), 125

4.11(Signaling a cancel operation), 126

4.12(Looking up a port), 126-127

5.1 (FTP client demo main program), 138-146

6.1(GLOBAL.PAS), 160-161

6.2(DATABASE.PAS), 163-170

6.3(DISPLAY.PAS), 171-182

7.1(PERSIST.SRC), 191-192

7.2(PERSIST2.SRC), 192-193

7.3(RDTSC.SRC), 194

7.4(COMP2STR.SRC), 194-195

7.5(OUTLNLBX.PAS), 196-197

7.6(STRLIST.PAS), 199

7.7(BEFORE.SRC), 200

7.8(AFTER.SRC), 200-201

7.9(SIZECHAN.SRC), 202

7.10(SETCOLCT.SRC), 203

7.11(SCRNCAP.PAS), 205-206

7.12(RBTNGRPS.PAS), 207-208

8.1(LAERFRM.PAS), 212-219

8.2(SVRUTILS.PAS), 224-228

8.3(RZCOLCBX.PAS), 228-232

8.4(DLLASER.DPR), 234

10.1(TSizingRect.CreateParams method), 266

10.2(TSizingRect.Paint method), 266

10.3(SizingRect’s MouseMove event handler), 267

10.4(Adjust Size & Position OnClick handler), 270-271

10.5(Escape/No Changes OnClick Handler), 272

10.6(Tab order menu item’s OnClick handler), 274

10.7(Changing fonts of all controls on a form), 276

10.8(Changing the font for a single control at runtime), 277

10.9(Event handler for FormCloseQuery), 281-282

11.1(Equivalent code for automatic range updates), 290

11.2(Special handling in range updates), 292-293

11.3(Double-click handler for recursive relationship navigation), 295-296

11.4(Loading an Outline component), 297-298

11.5(Using SQL to search a lineage), 301

11.6(Using SQL to bridge a known number of generations), 302-303

11.7(InterBase Select procedures), 304-305