Вы находитесь на странице: 1из 688

/

. .

^"
-
--

2003

32.973.233-0187
681.3.01(075)

/ . . .: , 2003. 688 : .
ISBN 5-318-00561-6

Delphi.
, ,
, ,
ANSI SQL-92,
.
COM, ActiveX -.
32.973.233-0187
681.3.01(075)

ISBN 5-318-00561-6

, 2003

I.
1 .
2.
3.

4.
5.
6.
II.
7.
8.
9.

10.
.
1 1 .
12.
13.
\
14.
15.
16.
17.
V.
18.









Delphi
-
...












COM, ActiveX -

Microsoft Office
ActiveX
-
-

19.
20.
2 1 .

14
23
24
38
58
90
121
151
173
174
213
245
286
311
312
353
380
413
414
428
443
484
509
510
552
596
622
668
669



CASE-



I.
II. Delphi
III.
IV.
V. COM, ActiveX -

14
15
15
16
16
17
18
18
19
20
21
21
22

I.

23

1 .

24









, ,

24
24
26
26
27
29
30
35
36
36
36
36
37
37
37
37

2.




,











3.

RAD Rapid Application Development
RAD
-


RAD




RAD


Oracle CDM
ISO/IEC 12207: 1995-08-01
34

4.
:









38
39
39
41
41
44
45
46
46
47
47
48
48
48
48
49
55

58
60
60
61
63
64
64
64
65
66
67
67
68
69
69
73
77
81
82
82
83
86

90
91
91
96
100
101
107
111
112
115
115
117

5.
SQL
SQL
SQL/92




,




6.


-
CASE-
CASE-


Power Designer








II. Delphi

121
121
122
123
123
124
125
126
126
128
135
136
137
140
142
143
143
145
147
147
149

151
151
152
153
154
155
157
157
159
160
161
163
164
165
165
168
170
171

173

7. - .. 174
Object Pascal
Object Pascal





175
175
175
176
176
176
177
177


Object Pascal




Object Pascal





Object Pascal
-


,

8.


Visual C++ C++Builder
Delphi
Visual Basic
Visual J++ JBuilder
Delphi
Delphi IDE



Delphi.


7
178
178
182
187
188
190
190
190
190
192
193
194
194
197
198
199
200
201
204
210
211

213
213
214
215
215
216
216
217
218
233
234
235
235
236
244

9.

245
Delphi
TMemo

Delphi




Delphi
Delphi
BDE

246
246
246
247
247
248
248
251
251
252
253
253
253


ADO

Delphi
TDataSource

TDBGrid






10.

Delphi
TForm

259
262
265
265
266
267
269
271
272
272
273
274
282

286
286
287
290
291
291
292
293
294
295
295
295
299
305
308
310

III.

311

1 1 .

312

SQL
Delphi, SQL-
TQuery
TADOQuery

SQL-
DQL
SELECT






312
313
313
314
314
318
319
321
329
330
332
332
334
337
341



UNION
UNION ALL




SQL-

12.


QuickReport
QuickReport
TQuickRep
QuickReport




13.







BDE





9
342
343
344
345
345
346
347
348

353
353
354
354
355
355
365
365
367
372
376
377

380
380
381
381
383
392
397
400
403
404
404
408
410

IV.

413

14.

414



TMenultem




TTool Bar
TToolButton

414
416
417
418
421
422
423
423
424

10

426
426

15. ... 428







TApplication





Application
Compiler
Linker


16.



WinHelp 4
WinHelp 4



HTML Help
HTML Help
HTML


WinHelp
Delphi HTML Help

17.

PVCS
TeamSource
TeamSource
TeamSource
TeamSource
TeamSource
TeamSource
TeamSource

428
429
430
431
432
433
434
436
436
437
438
438
439
440
441
441
442

443
443
444
446
447
447
450
450
456
465
466
467
476
477
477
480

484
484
485
485
485
486
486
487
487
488
488
488
489
492
496

11

TeamSource

499
507
508

V. COM, ActiveX -

509

18.
Microsoft Office

510


510
Microsoft Office
511

513
..513
....515
Delphi MS Office
518
MS Office
520
MS Word
520
Application
520
Documents
522
Document
524
MS Word
527
MS Word
531
MS Excel
535
MS Excel
536
MS Excel
539
Excel
541
MS PowerPoint
547
Application
548
Presentations
549
Presentation
549
Slides
550
Slide
551

19. ActiveX

552





lUnknown
Querylnterface
AddRef Release


Delphi
TComObj CoClass
Delphi








552
553
553
553
554
554
556
557
557
558
558
559
559
559
560
562
570
573
576
576
577

12


IDispatch
Delphi

-



ActiveX
ActiveX
ActiveX Delphi
ActiveX
ActiveX ActiveForm
VCL ActiveX
ActiveForm

20. -

IP









web-

Web- web-
HTTP


HTML
HTML-

web-
CGI-
WinCGI
ISAPI
ASP

2 1 . -
Personal Web Server
CGI
CGI-
CGI-
,

577
577
578
578
578
578
581
585
585
586
587
587
589
589
591

596
596
596
597
598
598
599
599
600
600
601
601
602
602
603
604
605
606
608
609
610
613
614
616
617
618
618
619
620

622
622
623
624
624
627
627
627


Delphi web-
Delphi Web Module
ASP Active Server Pages
ASP- web-
ASP
ASP Delphi
ASP- ,
IRequest
ASP-, ,

ASP


ASP-
,

13
632
633
650
650
652
652
656
656
657
660
661
662
663
664
665

668

669



: ,
.

:
;
.

( ,
),
.
, ,
, ,

.
.
, ,
, .

.
,
. ,
, .

- ,
: , - .

. ,
.
,
.

15


,

.

, , .
, :
,
.
;
,

.
, , ,
,
-
.
,
:
, ;

.

, .


, ()
.

,
- ,
.
.
-
(ObjectStore, Objectivity, 02, Jasmin),
, , ,
, SQL-92 (
, , Oracle, Informix, Sybase, DB2, MS SQL Server).
-.
, -

16

.
, .
.
,
.
,
. ANSI
SQL 92, SQL- SQL,
. ,
( ),
.

CASE-

,
.
, ,
.
,
,
.
-
, CASE-,
. CASE (Com
puter Aided Software/System Engineering)
. CASE,
,
,
. CASE-
,
, ,
,
, , , ,
, .


, ,

. , ,
. ,

17

. ,
.
,
.
,
.

,
. :



, .
Power Builder Sybase;
,
, ,
, .
Borland Delphi
Borland Visual Basic Microsoft.
,
.
Borland
Delphi, . Delphi
- Object Pascal,
. ,
Object Pascal . -
,

.
-
. ,
.

, .

, -
.


,
.

Borland

18

Delphi. ,
, ,
,
ANSI SQL-92,
. ,
.


, 5 .

I.

( 1 -6)
.
,

.

.
. ,
,
.


, CASE-.

.
1. .
, ,
, ,
, .
.
2. .

, .
.
3. .

RAD (Rapid Application Development),
RAD.

.

19

4. .
. ,
,
. ,
.
5. .
,
, .
SQL,
ANSI 92.
6. .
,
(CASE-).

CASE- Power Designer.

II. Delphi

( 7-10) -

. -
-
30 , -
90- .
,
.

,
.
,
.
,
.
7. - .
- .
Object Pascal,
Bor
land Delphi. Object Pascal
- .
-
.
,
Windows.

20

8. .

,
Borland Delphi.
,
. Borland Delphi , : Delphi
Windows Linux.

G 9.
.
, Borland Delphi.
,
, -
. ,
. Borland Delphi
-
.
, .

10. .
.
9
,
,
, .

III.

,
, , .
, ,
.
.

11. .
SQL,
.
Borland Delphi,
SQL.

12. .
,
, . Borland Delphi
, .
.

21

13. .
,
.
Borland Delphi .

IV.

, ,
,
. ,
. ,
,
.
14. .

.
15. .
Borland Delphi, ,
.
16. .

, - .

WinHelp, HTML Help.
17. .
.
,
TeamSource, Borland
Delphi.

V. COM, ActiveX -
ActiveX
, Win
dows.
,
,
. ,
WWW , .
web-
.
COM, ActiveX .

22

18. Microsoft
Office. ,
, Borland Delphi, ,
Microsoft Office.
19. ActiveX.
ActiveX.

, ActiveX.
20. -.
,
web-.
HTTP HTML.
21. -.
web- Borland Delphi.
web-
.


, ,
comp@piter.com ( , ).
!
web-
http://www.piter.com.

,
, ,
, .



, , , /
.
.
,
, :
-;
;
;
;
() .
()

, .

,




.

25

,
:
;
;

.
.



.
.

.
, ,
.
. ,
, ,
, .




, ,


.




,
, -
. ,
:
: 90- -
;

. -

, ;

-
;

26

1.


, ,
. ,
- ( -).

,
.
.




:
,
, , ,
.
.
,
.
-,
. ,
, ,
.
,
.

.

.
,
.

, , , .




. ,
. , ,
, , -

27


.
,
.
.
,
.
. ,
,
(, ),
( ,
).
,
( )
,

, .

,
.
-
, , ,
.

,
,
.
, ,
,
.
-
, , ,
,
.

. ,
, (
, . .),
,
.


.
.

28

1.



(. 1.1):
;
;
.
!
1

. 1.1.


, ,
( ).
, ,
,
.
().
Clarion, Clipper, FoxPro,
Paradox, dBase Qicrosoft Access.




.
( SQL-) .
SQL-, ,
. ,
Oracle, DB2, Qicrosoft SQL Server, InterBase, Sybase, Inforqix.



,
.
.
- .
,
.
Oracle, DB2
Qicrosoft SQL Server.

29


.
, .



(. 1.2):
;
;
- ;
Q .
\

. 1.2.

, ,
,
.
OLTP (OnLine Tran
saction Processing),
, .
OLTP (, )
, , , . .
:
;

.
DSS (Decision Support Systeq)
,

: , .

30

1.

-
.
.

,
.

,
.
. ,
,
.



(. 1.3):
-;
-;
;
/-.

aawftffijffiflBpBMfeij;

jK-jjK3jj

W!saaw?wwfea;

Internet/Intranet

. 1.3.


(. 1.1),
.
.
1 . 1 .

PS

Presentation Services
(
)

,
,
PL,

31

PL

Presentation Logic
(
)


.
,

BL

Business
or Application Logic
( )

,
,

DL

Data Logic (
)

(SQL-),

DS

Data Services
(
)

,
,
, ,
. .
SQL-

FS

File Services
( )


.
()

-
- PS
PL ,
. - ,

.
.
-
, PL, BL
DL.
,
.
:

, .

-
.
- .
,
( ),
- . ,
- .
,
,
.

32

1.

, -
, . , ,
( ,
).
,
. ,
. -
, ,
.

-
- -
,
.
- ,
SQL (Structured Query
Language) , .
,
, ,
.

, ,
SQL- .
- ,
. ,
P S PL ,
. DS FS
, (PS, PL), BL DL .
- :
, (. 1.4.).

PS, PL

DS, FS

BL, DL
. 1.4. -

,
. , -

33

, ,
. SQL- ,
.
,
.

BL .
.
SQL ,
.
,
.
,
.
, ( ).

,
, .
,
.
:
, . -
.

, .

-
.
,
. UNIX.
-

.

,
.
-

.
.


-
:

34

1,

,
PS PL
;
,
BL DL
DS;
Q
, DS
FS ( ).
, ,
Oracle, Sun, Borland .

,
-
.

.
,
. ,
, . PL,
BL DL , .

,
.
:
, ,
, .
-
. ,
, .
UNIX,
Qicrosoft Windows NT
.
( )
.
.
-
.
,

- .
- .

35

/-
/
.
,
.
,
, /-
.
:
web-.
/- -


.




.
.
, .

.
, ,
,
.

.

.
.


,

- (
).
,
,
.
,
.

36

1.



. .
-, ,
. -,
,
.


. ,

.



.
,
,
. ,
.

, ,
, ,
,
.
?

, ,
. ,
.



.
.

, , ,

.
, , -
, ,
.

37


-
, ,
,
.
,
.


.

.
.


,
, ,
.

.

-,
. ,
, , .




. web. Web- ,
:
;


, , .
, web-
.

, ,
.
, ,
.
. , ,
,
.
, .
,
(), ,
, .
.
:

-;
(
, , . .);

, ,
.

.

:
( ).
,

39

: , ,
. .;
, .
,
, , .


.
(
) ,
, (,
).
.



,
, ,
, ,
.

(, , )
,
.
.


:
Q
, ;
;
Q ;
;
;
, ;
,
;

.
,
, . -

40

2.

,
.
,
,
(. 2.1).
:
;
;
.

, ,

.

I U

. 2 . 1 .


,
, (
). ,
( ).

,
(
).
,
,

. ;
Q

;
;
;
, ;
.

41


, ,
, , , , ,
. .
. .
. :
( , ,
);
( ,
).
,
. :
;

;
;
;
.

, ,
, :
,
;

,
,
.

:
;
;
;
.

, , ,
.



, ,
, : ,
, , .

42

2.


{, ).
,

.

.
:
G ;
;
;
;
.
.

,
( ) .


,
, :
, ;
;
;
;
, ,
;
;
, .



.
:
, ;
;
, ;
, ;
;

43

;

.

, ,
.
:
Q ;
;
;
;
, .


, , .
:
;
;
.


,
,
. :
;
G ;
,
;
, , ;
;
;
, ,
, .

,
,
. 30 %
, 20 % , 20 % ,
30 % .

44

2,

, ,
, ,
, .
.
:
;
, ;
;
;
( );
;
Q
( ).

,


.
,

.
,
ISO/IEC 12207.

ISO International Organization of Standardization (


). IEC International Electrotechnical Commission (
).

ISO/IEC 12207 ,
, ,
.
:
(, , ,
, );
,
(, , ,
, , , , );
( ,
, , , ).
.

, ...

45


:
, .
, ,
, .



.
:

;
,
;
, .


, ,
, , ().

.
:
;
;
.
:

;
;
;
;
.


.

,

,
.

46

2,


:

.

;

( ) (
).

;
,

. :
, , ;
,
, ,
, .

,
,
.



. ,
,
.
, ,
, ,
/ ,
,
. ,

.


,

. :
;
;

47

G
;
.
,
.

, , .

. ,


.



,
, , , , ,
. , ,
. .
, Rational
Software.
(
CASE- Rational Rose).
, Rational Software,
:
;
;
;
( ).

,
,
, .



.
, ,
.

.

48

2.

:
;
;
, ;
.


,
.
, ,
. ,

.

, .


,
.

.



.
,
. , ,
.
,
.




, ,
,
, ,
.
ISO/IEC 12207
, -

49

, .
,
, .
,
. -

, .

:
, (waterfall);
.




.
70- 80- .

: , ,
.
. ,
, ,

.
.
,
,
.
, ,
.



. ,

.
, (. 2.2):

;
;
;
;
.

50

2.

. 2 . 2 .

,
, . ,
, ( ),
.
,
, .
,
.
.
() ,
. , ,
.
.

, .
,
.
.
, .

. ,

. .
,
.
.


,

.
:
,
. -

51

,
:
, , , , ;

.


. ,
. ,

,
, .
, , ,
.
, ,
,
. ,
.

.



. ,
:
;
, ,
,
;
;
;
;
.

. ,

.
,
.

-, ,
,
.

52

2,

,
,
,
(, - ,
. .). ,
, ,
.
. .
, ,
, ,
. , ,
,
.
,
.
,
, (,

). ,
. ,
, ,
. 2.3.

\
i

. 2.3.

, ,
,
, ,
. ,
,
,
.
.
,
. ,

53

() ,
.

. ,
,
.
.

. .
, , ,
,
. ,

. , ,
,
. , , ,
. (, ,
)
.
.

. ,

, .
,

.

.
,
.
.
, ,
. ,
,

.
, , ,
. ,
,
( ).
, .
, ,
.

54

2,



.
,
.
,
.

.
. , ,
( )
.
, .
,
.

,
. .

.
. ,

, .
,
, ,
. ,


.
,
,
.
,
, .
, ,
.
, .
, ,
, .
: The Standish Group,
31 % (IT-)
; 53 % IT-
( 189 %, ); 16,2 %
, .

55

,
, .
( ) , .
,
.
,
. ,
,
, , ,
. .
, . ,

,
. , ,
.
. ,
. ,
.


, ,
.
, .

.

,
(
), ,
(. 2.4).

.
1 J
2

. 2.4.

56

2.

,
,
, , .

, ,
.

,
.

, . ,
.



, ,
, .
:

;

.
.
,
( ,
40 %
);
.
, .
.
.
,
.
,

,
, . . . 2.5

;

,
. ,

.

57

,
, ;

"

""N1'
\
\

'.
_

^->

. 2.5.

(

). ,
() ,
,
.
, ,
;


. ,
.
,
;


, , ,
,
.

,


.
.
.
.
,
.
,
, .



,
, .
,
(
), :
,

;

;
,
;
,
, ;

(
, , ,
).
, (CASE) . -

3.

59


, ,
.

,
, , ,
.

:

;
,
;
(),
.

:
, ( ),
;
, , ;
Q ;
.

,
(
).
,
,
:
;

;

,
, ;

. ,
, .
.
,
.

60

3.


( 3 - 7 ).

;

,
. ,
,
.
, ,

.

G ,
,
;

,
, .

RAD Rapid Application


Development

.

(
,
) ,
.

.


.

RAD
,
,

RAD (Rapid Application Development).
.

RAD Rapid Application Development

61

RAD
,
,
.

, :
( 2 10 );
,
( 2 6 );
,

, .
RAD
.
, , ,
.
RAD :

() ;

;

;
CASE-
;
,
;
,
;
;

;
,
.

-
RAD
:
(),
,
,
.

62

3.


- .
-
,
(
) .
-
() ,
().

. ,
.

,
. , .
, , ,
. ,
.
-
,
() ,
, ,
.
, ,
. , -
,
.
RAD
, .
.
, .
RAD

.
RAD,
(
,
).

.
, RAD
,
.
.

RAD Rapid Application Development

63


- .
.


-
,
. RAD

.
, .

, , ,
.
,
, , . .,
.
,
.

.
.

, Borland Delphi Visual Basic.
,

, . ,
,
.
ODBC OLE DB,
().

. , ,
.
Power Builder Sybase (,
Sybase Anywhere Server) Visual FoxPro Microsoft.
,
, ,
,
, , .

, RAD .

64

3.

RAD
: , ,

, .


, RAD, -
. : ,
, ,
. : ,
, , ,
. .

,
. ,
. ,
.
, (DELETE, INSERT,
UPDATE),
.
, ,
.


RAD

:
;
;
;
.
.


:
,
;
,
;
;

RAD

65

;
;
,
,
.
,


.


CASE-,
.

CASE (Computer Aided Software/System Engineering)


. CASE
.
,
.
CASE- ,
,
,
, , , ,
, ,
. CASE-
6 .

, CASE-,
, ,
. ,
.


CASE-, .
,
.
.


. .

66

3,


: , (
). .

.
,
RAD- (
). CASE-
.
.
:
;
,
;
CASE-
;
, .

RAD ,
.
, . (
,
,

, .)


.

,
.
.
, CASE-.
.
,
,
.
.

,
,
, .

RAD

67

, :
;
;
;
Q ;
;
.
,
.



.
,
, .


. .
,
(,
).
,
.

RAD
, RAD (, ,
) .
,
.
, ,
,
, ,
.
,
- ,
, ,
.
,
,
.

68

3.

RAD
, ,
-
, .
RAD ,
,
.
, .
RAD ,
, ,
. , ,
RAD, ,
,
.



.

. ,
.


. , ,

.
,
.

,
.
(
, ,
).
.

( (), ())
.
, ,
.

.
, :

69

;
Q ;
, .



:
Q .
( , , )

;
.
,
(, , ANSI, IDEF0/1),
(, OMG),
- ,
(, -
SQL ),
(, Microsoft ODBC);
.
- ,
-, , .

, , ,
,
;
; , .

,
:
Q Oracle CDM (Custom Development Method) no
;
ISO/IEC 12207:1995-08-01
;
34.

, ,
.

Oracle CDM
ORACLE

70

3,

,
. Oracle CDM
Oracle CASE-Method, CASE Oracle CASE ( Designer/2000).
CASE- ORACLE
:
,

;
,

;
-
,
, ,
,
;
, ,
. ,
ORACLE;
.

ORACLE.


,

;

. ,
(
)
(
),

;

:
,
;

.

71


()
, .
Oracle CDM
:
;
( );
(
);
( );
Q ( ,
);
( ,
).
,
, .
,
. ,
,
.

, , .


, ,
. . :
,
;
, .
( )

,
.

.
,
.

, DESIGNER/2000,
,
.

72

3.

Oracle CDM ,
:
;
;
;
;
;
;
;
Q ;
;
;
.
,
.

Oracle CDM
Oracle CDM,
.
CDM :
;

Oracle;

.
,
CDM, .
( ),
,
.

.
, ,
.

,
.
.
-
, -
,
, .

73

Q CDM Oracle,
CDM ,
.
Oracle CDM ,
,

Oracle.


ISO/IEC 12207: 1995-08-01
ISO 12207 1995 .
ISO/IEC JTC1 , SC7,
.
, ISO 12207 ,

, .
,
.

ISO 12207,
, ,
,
.
ISO 12207,
, , ,
.

Oracle CDM ISO 12207


: ()
(); ,
.


ISO 12207 - ( )
.
, Oracle CDM ISO 12207
: , ,
. . , , ISO 12207
Oracle CDM .
ISO 12207, ,
.
ISO 12207 CDM ,
, -

74

3.

,
(,
. .).



ISO 12207
:
-,
,
;
-,
,
;
-,

;
-,
(
) .
,
(
),
, .,
;
,
,
,
;
.
, ISO 12207 8 ,

.
:

;
;
;
;
;
;
;
.

75

ISO 12207 :
;
;
;
.

ISO 12207
,
, , . .,
.

, ISO 12207 ,
, ,
.

ISO 12207

ISO 12207.
Q ISO 12207 ,
,
.
.

ISO 12207, ,
, , ,

, .

ISO 12207 .
,
.
, ,
.

ISO 12207, ,
.

.
, .

,
. -

76

3,
,
, ,
. ,
.
, .




- .
CDM
,
.
:
ISO 12207

,
.

,
. ,

,
.
ISO 12207 , ,
, . .,
. ,
, :
Q ,
;
:
, ,
, , , ,
, , ;
.
,
11 ,
.

:
, ,
,
;
() ;
;

77

, ,
,
;
, ,
;
(
), ,
, ,
,
;
Q ;

();
;
Q ;
.

ISO 12207,
( ),
, (
)
.


, , -
:
Q ;
;
;
,
.

34
34 80-
.
,
.
.
ISO 12207, ,
(,
). 34 -

78

3.

,
ISO 12207. 34
,
.



0 6 ,
.
34.601-90 ( ),
34.602-89 ( )
50-34.698-90 ( ).

,
.
34,
.
.
:

;
;

.
:
;
- ;
,
;
.

.
:

;
.
:
;

, ;

79


/
;

.
:
;
/ .
:
;
;

;
;
- ;
;
;
.
:
;
.
34 ,
.

34 :
34
,
- . 80-
,
:
(24-
) , , , -
;
23501,
();
14- ,
().
, , , ,
, , ,

80

3,
,
, ,
, , .

, ,

.

, 34
, ISO 12207.
34
:

;
,
;
,
;

,

.
,
,
, ISO 12207.
,
34
.
34
,
. 34
,
.

Q 34

.
, ISO 12207.
34: ,
34, , .
:

.
Q
() . -

81

,
.

- ( 34.60289), ( 50680-88).

34, -
, -
, , .
34
:
- ,

(, , . .)
- 50-680-88;

,
,
34.003-90.
,
,
, - .

,
, .
, ,
.
, ,
,
ISO 12207.
, .
ISO 12207 ,
. . ,
,
.
Q 34 :
;
,
;
, , ,
ISO 12207 .

82

3.

34 , ISO 12207, ,
,
,
.
34
,
(,
) ,
.
34 CDM
, a ISO 12207 (
, ).

,
.

: , ,
, , , .


.


, ,


, ,
.

, ,
.

.
( )

,
.

.

83

/
, .

.

.

.
,
, ,
, ,
.
-

, ,
,
,
.
:
;
, , ,
.

:
,
;
,
.

, , ,
.

, .




:
Q ;
;
;

84

3.


, ;
.
,
, .

,
:
D ,


;
,

;

, : ,
, .

,
,
-
;



.

.
. ,
, .
-
. ,

.


,
-
.
(OSE/RM)
: (
) ,
.

85


Application Program Interface (API),
. ,

.

. ,

:
, ;
;
Q
;
, .
:
-
, ,
;
Q ,
, ;
Q ,
,
,
;
, ,
,
;
/
.

, .

.
, ,
.
,

. ,

.
,
.

86

3.



, .

, ,
.
, ,
. , ,
, ,
,
. ,
,

.
,
,
,
.
, ,
,
.




, , -
.
:
Q ;
,
;
,
;
,
,
;

, ,
,

;
.

87


:
;
Q ;
;
, .


-
.

.
.
, ,
API,
.

,
.



.
(API)
.
,
,

OSE/RM:
;
- (,
SQL-92 );
,
;

: , , ,
.

, (, Ethernet
IEEE 802.3 Fast Ethernet IEEE 802.3 ),

.

88

3.


:

; ; .
,
(,
).



,
, .
-
,
, , ,
.
,
:

, ;
,
;
, ;
,
;

, ;
.

.

.


, ,
,
.
,
.


. ,
.

89

, ,
, :

;
,
;

;

;
Q (
);
;
.
,
,
, . .,
, .
, ,
.
, ,
.

,
.

, ,
/ .


.

, .
,
, ,

(
Fortran,
).
,
, ,

.

,
/ ,
.

,
, , ,
.
, , , ,
.
,
.

,
, ,
. -

91

. ,
,
(
700-800 ),

10-15- .

:
,
, 60- 70-
,
() {DataBase Management Systems DBMS).
,
.
.
,
:
;
;
;
Q .


, ,
:
;
Q ;
;
;
.
.




(
, ) ,
, ,
(
). ,
,

92

4.

.
.
,
.


, , ,

. ,
, , ,
. ,
,
.
,
. ,
( UNIX),
,
.

.

, ,
.
,
, .
,
.


,
. ,
(COMMIT)
, (
).
,
(ROLLBACK) ,
,
.

.

, . ,

93

,

.
, ,
.


.
,
.
,
. ,
, ,
,
(
).
.
,
.

.
. ,
(
) .


. ,

.
:
.

( Windows);

.
.
,
, .
.
.

. , -

94

4.

.
, ,
.
.
,
(
, ),
.
:

,
. .
(
Write Ahead Log WAL).
, ,
,
.
WAL,
.
.
,
.
, ,
,
. ,
,
, ,
, ( ).

, , ,
, ,
(
, ).
WAL
, .

,

.
, ,
,
.

. -

95

(
).
, , , .
, , ,
, .

.
,
.


, ,
, .
:
(Schema Definition Language, SDL)
;
(Data Manipulation Language, DML)
, ,
, ,
.

.
,
, ,
.
SQL (Structured
Query Language). ,

SQL.
SQL
. (
)
, SQL

-.
SQL
. ,
-,

SQL
.
SQL
,
( -

96

4.

) , .
, ,
, , ,
.
.
,
SQL. ,
SQL
. , ,
.

, .
-,
.

SQL.
.



.
10-15
.
.
:

, ;

;

. ,
;

,
.
mainframe-

.

, ,
,
,
.

97



,

.
.
.


,
( CODASYL).

(mainframe), IBM 360/370,
-
.
:
.
, , ,
:
;
;

;

;
;
.
:

;
;
Q
( ).
,
:
, -
. , ,

: ,
.

.

98

4.



70- . ,
,
.
,
(, , ,
). ,
,
(- relation,
).
,

.


. ,
,
, ( )

.
,
.
, .

, , ,
,

.
.

, ,
. ,

.


, , QBE Query by Example
( ), Quel Query Language ( ) SQL Structured Query
Language ( ).
SQL, 1986 .
ANSI .
1992 ., , ,
SQL-92.

99

-
,
.

- ,
- ,
, ,
, ,
,
.
- ,
:
(
) ;

;
,

.

- ,
.
.
. ,
IBM Oracle (DB2 Oracle ),
. ,
,
. ,
- .

.
, .

.

, .

. ,

.

100

4,

(, ,
- )
,
.


. ,
.
1970 . A Relational Model of Data for Large Shared
Data Banks (CACM, 1970, Vol. 13, 6).

,

.
.
70-
.

:
,

, ;
,


;

.
,
. 70-
,
.

, 80-
.

, .
,

(
),
.

101

.


.

- .


( relation )
,
, .
, ()
.
,
, .
:
;
;
;
;
Q .
() ,
(. 4.1).
4 . 1 .
_

23980282

. .

12.03.1982

22991380

. .

25.12.1979

22657879

. .

29.02.1979

24356783

. .

19.08.1983

24350283

. .

03.10.1982

23125681

. .

26.03.1981



.
.
:
Q ;
;

102

4.

;
;
( / );
(
; BLOB Binary
Large Object).


( ,
, Ingres/Postgres).

(
), ( _)
( __).


() .
. ,
.
:


,
( , );
_ _

;
_ __

, ( 1 6)
( ).

,
,
.
, ,
, .
, .

:
, .
, , -

103

, . _
__
, .

.
, , Oracle InterBase.

, ,
, ,
.
( ,
) .
:
{__ __
,
_ _.
_,
}

.
, , ,...,
-.
, 5-.
.

, ,
{ , },
, .
( ,
). , ,
. ,
.

,
.

( C/C++, Pascal).
.
-.
.
:
. .

104

4.

, ,
.
.
6.
.


- .
,
,
.
__ (
, ,
- ). ,
. (

, .)
,
, ,
.
, ,
,
.

NULL.


,
,

. ,
( ),
.
( ) .
:
R , ,..., , = (,
...,Ak) R
, :
:
R , ..., ;
: , ,...,
.

105


. .
, , ,
.
, ,
( ) .
, .
,
.
,
.
, .

, ,
, . ()
, ,
. ,
.

, , ,
- , .
,
,
.
, ,
.
,
, .
, .
, ,
, .


__.
, .

;
.
,
.
,

,

106

4.

. ,

( , )
.
,
.
, .

.
.
,
.
.

.
.
.

,
, ,
. ,
,
.
, ,
, ,
. ,

. ,
.
,
, ,
, ,
, , , .
(
,
).
.

,

, .
, ,
, .

107

,
.
.
.
, ,
.
.
:
UNIQUE ,
;
NOT NULL ,
, NULL.
,
.



.
(relationship). ,
.

.
,
. ,
. 4.2.
4 . 2 . ,

__

23980282

23980282

22991380

22991380

NULL

22657879

24356783

NULL

__
(
). ,
,

108

4.

__
.
,
__.

. .



. __
, .
__
{foreign key).
( ) ,
( ) .

.
.
,
.
,

.
.
,
, .

,
, . ,
__ ,
_.

, .
.


, ,
,
. ,
.
.
, .

109

:
;
.
.

, , . ,
.
, ,
. , ,
,
. ,
.

: .

, .
,
, ,
.
, .
.
(, ),
,
,
, .
,
, .

.

. ,
. (

) ,
. ,
, ,
:
,
, (
,
);
, ,

;

110

4.

( ) ,
, ,
.


. ,
.


, , ,
. , ,
FoxPro 2.6 , dBase
DOS.



(master), (detail).
.
.
,
.

,
.

.
.
, .
.
, ,
.

:

;

;

;

,
.

111

,
, .
,
, .
,
.



. , ,
, .

.


.

( , , SQL)

.
,
, .


,
{ , }.
.
, ,
,
.
,
,
.


.
,
().

112

4.


,
, .
. ,
,
.
.
, , , ,
.
,
;
( ).
,
.



, ,
. :

;
() (
). ,

NULL;

, ;
,
(, ,
);


, .
, - ,
;

.
,
.

.
,
.

113

,
. ,
. ,
, ,

, , .
, ,
.
.
.

, .

,
, .


, .
.
,
, .
,
.
. . 4.1
, .
, ,
, ,
. ,
.
, .

. .
1
. .
4
. .
5
. .
1000
. .
3
. .
6
. .

1
2
3
4
5
6

. .
. .
. .
. .
. .
. .

2
4
5
1
1
3

1000

. .

. 4.1.

. :
;
;
.

114

4.



. :

, ;

(
)
.


.
(, . 4.1,
).
.
,
, , .


:
,
( );
, ,
.
,
.

.
.
,
,
, ( ,
.). ,
, .
:

, ;

, ;

, ;

115

.

, .
, .



,
.

, ,
. ,
,
.


,

.

( ) .
, :
;
;
;
.
,
,
, .
. 4.2.



. 4 . 2 .

116

4.


,
. ,
( ) . ,
. 4.2, ,
, .
, ,
,
.


. ,
, , .
, , ,
.
, ,
.



. , ,
.
.
, .
. (

, .)



, NOT NULL.
, , ,
,
.
,
. NOT NULL,
.
.

, , .
,
.

117


.
,
,
.

:
Q (1NF);
(2NF);
(3NF);
(BCNF);
(4NF);
, - (5NF
PJ/NF).
:
Q
;

.

, ,
, .


. ,
.
: X > Y.
, X,
, ,
.

,
.



.
,
( , . 4.2)
.

118

4.


,

.

,
.

,
:
1. , ,
(
).
2.
.
.
3. , ,
, .

.
.
. ,
, ,
.
, .
. 4.3.

^>

^ >

. 4 . 3 .

,
-

119

.
.


,
.
.
.

X / R
, Z,
X-^Zv\Z-> , Z>.

,
,
, .
, , ,
, (
). ,
, ,
, .
, ,
, ,
, . ,
- .
.
R ,

.
,
:
1. ( ), .
2. ( )
. (
), ,
.
3. , ,
.

, ,

.
,
. , , .

120

4 .


.
(. 4.4).

^>

^ >

. 4.4.


,
.
,
.

. 4 . 5 . ,

,
(. 4.5).


. ,
,
.
, :
SQL Structured Query Language ( );
QBE Query By Example ( );
QUEL Query Language ( ).
SQL,
, ANSI.

SQL ,
.

SQL
.

SQL
SQL 70-
System R
IBM.
SEQUEL (Structured English Query Language).
SEQUEL .

, -

122

5,

, ,
,
:
;
;
;
,
;
;
.
70- SEQUEL,
SQL, Oracle
. 1983 . IBM SQL
DB2.
(ANSI) SQL
1986 .
1989 . , 1992 .
SQL
ANSI SQL-92 SQL/92.

.
, ANSI SQL ,
. , ,
SQL.
, ,
. ,
, SQL , SQL
ANSI SQL-92.

SQL
SQL .
:
DDL (Data Definition Language) .

(, );
DML (Data Manipulation Language) .
DML ,
;
DCL (Data Control Language) .
,
;

SQL/92

123

DQL (Data Query Language) .


, (
);

;
.

.
11 .

SQL/92
, SQL,
:
;
;
.
.


SQL/92 :
;
.


, ,
, ,
, .
ANSI SQL-92 :
CHARACTER(n)

, ,
.

. , 10, ,
3 , 7 .

CHARACTER ,
, ,
( ).

124

5.


,
, .
:
VARCHAR(n)

, .
CHARACTER VARCHAR
. ,
, ,
. ,
VARCHAR (10) 3 ,
, 10,
.

;
;
.


ANSI SQL-92 :
INTEGER , 4 .
- 2 147 483 648 2 147 483 647;
SMALL I NT , 2 .
-32 768 32 767.



.
, ,
( ,
). ,
, ,
.
:
DECIMAL(n.m)
; m .
.
, .

SQL/92

125



. ,

.
,
, , .

.
:

FLOAT ;

DOUBLE .


.
.
,
.
:
1()
.
:
BIT VARYING(n)
.


, ,
.

, ,
.
S Q L
:
DATE ;
TIME ;
Q TIMESTAMP ;

INTERVAL
.

126

5.

, SQL
. ,
, ANSI SQL-92,
SQL.
, , SQL
, ,

.


,
.
, .
DDL
SQL.

,

. ,
, , . ,

, .
,
.
,
,
.

CREATE TABLE
CREATE TABLE.
:
CREATE TABLE _ (
__1 _.
__2 _.

_o_N _)
, ,
:
CREATE TABLE _ (
__ INTEGER,
VARCHAR(25).
VARCHAR(25).
VARCHARC25).

127

_ DATE.
VARCHAR(50).
VARCHARC25))

, ,
.
,
. ,
,
,

. .

ALTER TABLE
ALTER
TABLE. ,
, .

ALTER TABLE ANSI.


SQL,
. ALTER TABLE,

, .

ALTER TABLE :
ALTER TABLE _ [MODIFY] [_ _]
[ADD] [_ _]
[DROP] [_]

, ALTER TABLE, ,
:
MODIFY ;
ADD ;
DROP .

ALTER TABLE:
ALTER TABLE _ ADD (_ _)

, , ,
,
:
ALTER TABLE _ ADD (Email CHARACTERS))

,
ALTER TABLE MODIFY:
ALTER TABLE MODIFY ( _)

128

5.

, ,
Email, , CHARACTER
, ,
.
V A R C H AR. ALTER
TABLE:
ALTER TABLE _ MODIFY (Email VARCHAR(25))
ALTER TABLE
DROP:
ALTER TABLE _ DROP (_)

ALTER TABLE.

.

DROP TABLE
DROP TABLE.
:
DROP TABLE _ [RESTRICT | CASCADE]
DROP TABLE RESTRICT
- ,

. CASCADE,

.


,
.
,
:

NOT NULL;

Q ;

UNIQUE;

CHECK.

NOT NULL
NOT NULL
. NULL ,
.

129

, NULL
,
( ), , 0 ( ,
). NULL, ,
( ),
.
NOT NULL
CREATE TABLE. NOT NULL ,
NOT NULL :
CREATE TABLE _ (
__1 _ NOT NULL.
__2 _ NULL.

HMfl_noflfl_N _ NOT NULL)


NULL,
. NULL
, .
NOT NULL ,
- .
, , ,
NOT NULL ,
.
:
CREATE TABLE _ (
__ INTEGER,
VARCHARC25) NOT NULL,'
VARCHAR(25) NOT NULL,
VARCHAR(25).
_ DATE.
VARCHAR(50).
VARCHAR(25))

ALTER
TABLE NOT NULL .

. :
1. NOT NULL.
2. .
3. ALTER TABLE,
NOT NULL.


. ,
, NULL, -

130

5.

NOT NULL.
.
,
PRIMARY KEY,
CREATE TABLE:
CREATE TABLE _ (
__1 _ NOT NULL PRIMARY KEY.
__2 _.
__ _ NOT NULL)

, NOT NULL ,
, .
Q ,
. PRIMARY
KEY, ,
:
CREATE TABLE _ (
__1 _ NOT NULL.
__2 _.
__ _ NOT NULL,
PRIMARY KEY (__1))

.
,
:
CREATE TABLE _
__1 _ NOT NULL.
__2 _,
__3 _ NOT NULL.
__ _ NOT NULL.
PRIMARY KEY (__1. __3))

NOT NULL
, .

UNIQUE
UNIQUE ,
,
, . , ,
UNIQUE (, ,
NOT NULL).
UNIQUE
UNIQUE, :
CREATE TABLE _ (
_1 _ NOT NULL PRIMARY KEY,

131

__2 _ UNIQUE,
__3 _ NOT NULL.
__ _ NOT NULL UNIQUE)

UNIQUE , .

, ,
, . ,
, ,
.
UNIQUE , ,
:
CREATE TABLE _ (
__1 _ NOT NULL PRIMARY KEY.
__2 _,
__3 _ NOT NULL.
__ _ NOT NULL UNIQUE,
UNIQUE (__2, __3))



. ,
, ,
, , ,
(
).

. .

.
.
, ,
. ,
, ,
.
,
, . ,

.


(. 5.1). :
Q
;

132

5.


;
.
,
, ,
.
.

. 5 . 1 .

(FOREIGN KEY)
CREATE TABLE, ALTER TABLE.
FOREIGN KEY :
FOREIGN KEY __( )
REFERENCES __ ( )

,
. ,
. ,
, :

;
.
, ,
.
:
CREATE TABLE _ (
__ INTEGER NOT NULL PRIMARY KEY.
VARCHAR(25) NOT NULL.
VARCHAR(25) NOT NULL,
VARCHAR(25).
_ DATE,
VARCHARC50),
VARCHAR(25))
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY.
VARCHAR(50) NOT NULL UNIQUE.
INTEGER NOT NULL.
DECIMALS.2) NOT NULL)
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY.

133

_ INTEGER,
__ INTEGER NOT NULL,
DECIMALS,2).
_ DATE NOT NULL,
_ DATE,
FOREIGN KEY _ (__)
REFERENCES _ (__),
FOREIGN KEY _ (_)
REFERENCES (_))


ALTER TABLE (, ,
SQL ). ALTER TABLE,
, :
ALTER TABLE _
ADD CONSTRAINT __ FOREIGN KEY ( )
REFERENCE __ ( )

, ALTER TABLE
,
.
.

, .
, , ,
, .
, , ,

__.
NOT NULL,
, . , ,
,
, .

, _,
.

. ,
- ,
. , ,
, .

,
, .
, -

134

5,

,
.
, ,
- ,
.

SQL
. ,
,
, (
) ( ).
ANSI SQL-92.


:
UPDATE OF __ CASCADES
DELETE OF __ CASCADES

UPDATE OF DELETE OF CREATE TABLE.


CASCADES RESTRICTED
,
, .
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY.
_ INTEGER,
__ INTEGER NOT NULL.
DECIMALS.2).
_ DATE NOT NULL.
_ DATE.
FOREIGN KEY _ (__)
REFERENCES _ (__),
FOREIGN KEY _ (_)
REFERENCES ( ),
UPDATE OF <tH3H4ecKHejiHL(a~CASCADES
DELETE OF _ RESTRICTED)

CHECK
CHECK ,
.
CHECK CHECK,
, .
,
, .

, ,
. CHECK
.

135

CHECK .
:
CONSTRAINT _ CHECK ()

, , .
, 20.
, , :
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY,
VARCHAR(50) NOT NULL UNIQUE.
INTEGER NOT NULL,
DECIMALC7.2) NOT NULL.
CONSTRAINT CHK_RATE CHECK (<=20))

.
. ,
, AND OR.
, ,
:
CONSTRAINT CHK_RATE CHECK (<=20 AND >=1000))


,
,
.

NULL ,
, NOT NULL
.

DEFAULT,
CREATE TABLE ,
:
CREATE TABLE (
_o_N _ DEFAULT -__

)
, ,
:
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY,
_ INTEGER,
__ INTEGER NOT NULL.
DECIMALS.2) DEFAULTS,
_ DATE NOT NULL.

136

5.


ANSI .
,
.

SQL.
:
CREATE INDEX _
ON _ (__1, [__2, ...])

CREATE INDEX
, SQL.
, ,
( ASC DESC).



. ()
, .
:
CREATE INDEX _
ON _ (_)

,
, , :
CREATE INDEX NAMEJDX
ON _ ()


.
,
, .

:
CREATE UNIQUE INDEX _
ON _ (_)

,
:
CREATE UNIQUE INDEX POSTJDX
ON ()

,
.

137


, .
,
.

.
:
CREATE INDEX _
ON _ (__1, __2, ...)


.
:
CREATE INDEX FULLNAMEJDX
ON _ (.)

,
,
, ,
, , .


.
(, , ).
:
DROP INDEX _
,
. .


.

.


(View) ,
.
. .
,
( ). ( ),
, (
).

138

5.

, ,
.
.

.
, . . 5.2
.




. 5.2.


. ,
.
, .
(,
, , ,
, ).


:
;
Q .
,
, .
. , ,
, ,
.
, ,
.
,
,
.
.

139


, .
, ,
. ,
,
,
.

, ,
11 ,
DQL SQL.
, .


. , ,
,
.
, , ,

,
.
SQL-. ,
,
.


CREATE VIEW.
/
.
:
CREATE VIEW _ AS
{ }

,
.

;
SELECT
11 .

,
, .
, .
,
( DDL)
.

140

5,


DROP VIEW,
RESTRICT CASCADE.
,
/ . RESTRICT
, .
CASCADE, DROP VIEW
.
DROP VIEW :
DROP VIEW _ [RESTRICT | CASCADE]

( )
, .
, .


(Stored Procedure)
SQL.
,
,
SQL.
,
.
,

SELECT.
, ,
:
.

;

:
,
,
;

:
,
, ;

: , ,
;

141

,
SQL. ,
.
:
,
.
,
;
,
.
.


CREATE PROCEDURE.
SQL,
.
CREATE PROCEDURE .
SQL, , ,
SQL , :
;
Q ;
.
. :
,
;
,
( );
,
.
:
(
);
,
BEGIN END. ,
.


, ,
.
SELECT (
11 ).

142

5.


EXECUTE.
SQL.


DROP PROCEDURE.
SQL
:
DROP PROCEDURE __

.

SQL,
, .
,
.


Object Pascal ( ).

.
:
, ,
;
,
,
;
Q .
,
, .


CREATE TRIGGER.
SQL,

.
, .
:
, ;
, ;

143

, , (

).
:
(
);
,
BEGIN END. ,
.
,
.
. ,
,
.

.
, .
SQL ( ,
) CREATE TRIGGER (
).


DROP TRIGGER.
SQL
:
DROP TRIGGER _


, ,
SQL, ,
(DML Data Manipulation Language).
DML ,
.
SQL DML:

INSERT;

UPDATE;

DELETE.



. INSERT.

144

5.



INSERT:
INSERT INTO _
VALUES (_1, _2

3Ha4eHne_N)

INSERT VALUES
, .
, VALUES,
, .


CREATE TABLE, .

, ,
. NULL.
.
:
CREATE TABLE (
_ INTEGER NOT NULL PRIMARY KEY,
VARCHAR(50) NOT NULL UNIQUE.
INTEGER NOT NULL,
DECIMALS,2) NOT NULL)


INSERT:
INSERT INTO
VALUES (12, ' '. 12, 2000.00)


,
.
INSERT:
INSERT INTO _ (__1, __2
VALUES (_1. _2
_)

__

,

. :
INSERT INTO _ (__, ,
, )
VALUES (234,'',''.'')

INSERT ,
.
, , .

145


NULL. , ,
, NOT NULL,
INSERT .

,

.
INSERT
SELECT.

SELECT
.
, 11 .

INSERT SELECT, ,
().
INSERT :
INSERT INTO _ (__1, __2
__
SELECT [* | __1. __2
__]
FROM _
WHERE

VALUES SELECT.
. SELECT
, ( SELECT
*, ). FROM
, .
WHERE
, .
,
INSERT, , .
:
INSERT SELECT . .

,
, , UPDATE.
,
. UPDATE
( ), .

UPDATE , (
, ).

146

5.



UPDATE, :
UPDATE _
SET _ =
[WHERE ]

UPDATE
: UPDATE ,
, SET
. ,
WHERE, ,
.

, WHERE UPDATE,
, , WHERE SELECT,
11 .

. ,
, (
,
). UPDATE
.
WHERE ,
.
__. ,
, . UPDATE,
, :
UPDATE _
SET = 4095) 2347890'
WHERE __ = 16

,
, 16.
,
.

UPDATE
.
UPDATE , .


UPDATE
. SET ,
:

147

UPDATE _
SET __1 = _1.
__2 = _2.
__ = ^
[WHERE ]


.
.


DELETE.
, .
DELETE :
DELETE FROM _
[WHERE ]

,
WHERE. WHERE
DELETE .



,
.


, .

,
.
,
.


.
, ,
.
:
;
.
.

148

5.



, : ,
, . ,

.
.
, :
;
;
;
;
;
.
. ,
.


,
. , ,
,
.
ANSI :
SELECT (
);
15_)
();
Q INSERT (
);
(_)
();
UPDATE
();
REFERENCE(_o)
(
);
REFERENCE .

,
.

149


SQL
:
GRANT;
REVOKE.

,
.

GRANT
GRANT ,
.
:
GRANT _1 [. _2]
ON _
_ [WITH GRANT OPTION]

USER
:
GRANT SELECT
ON
USER

GRANT .
, USER
, :
GRANT SELECT. INSERT
ON
TO USER

GRANT
WITH GRANT OPTION. , ,
,
. ,
WITH GRANT OPTION, USER,
,
:
GRANT SELECT. INSERT
ON
TO USER
WITH GRANT OPTION

REVOKE
REVOKE
. RESTRICT
CASCADE. RESTRICT REVOKE
,
.

150

5.

, ,
WITH GRANT OPTION GRANT.

CASCADE ,
. , USER1
WITH GRANT OPTION, ,
, USER2,
USER1 CASCADE
USER2.
REVOKE :
REVOKE _1 [, _2]
ON _
FROM _ [RESTRICT | CASCADE]

,
USER :
REVOKE INSERT
ON
FROM USER


SQL-.
,
, ,
ASE-.
,
, .
,

CASE-.




,
.

(. 4 )
.
,
:

.
.
;

152

6.


.
(,
) ;
,

;

() ,
, ,
- .





,
.
:
- ,
, ;
, .
-
-
.

- ,
.
CASE- (,
ERWin Power Designer). ,
, .
,
, .
.

,
.
(
-
).
,
().

153

-

- ( ER-
Entity () Relation ()).
ER-
( , ).
1976 .
,
.
ER- ASE,
.
ER- (
-),
. ER- CASE,
. ,
IDEF1X,
CASE- ( , ERwin, Design/IDEF, Power Designer).
ER- , .

,
,
. , ,
.
:
;
,
, ;
,
.

.
ER- ,
(. 6.1).
Worker

. 6.1.

154

6.

, , ,
, ,
( ) ,
-, -
-.
,
(. 6.2).
, .
Supv_Worker

Worker
WORKER-ID
NAME
HRLY_RATE

SKILL
SKILL_WORKER
"**

SKILL TYPE
*" BONUS_RATE
HPS_PER_WEEK

. 6.2.

,
. ER-
(. 6.3).
.
Worker
WORKER-ID N4
NAME A20
HRLY_RATE N4
. 6.3.

CASE-

CASE- (Computer-Aided Software/
System Engineering). CASE-
, ,
.

( , ,
. .). CASE-

.

CASE-

155

CASE-
CASE-
:
,
.

, CASE-

.
.
, ,
.

,
.
CASE-
:
. CASE-
, , ,
,
.
( ,
), ,
,
, ,
,
;
. CASE-
() ,

.
, ,
.
: ,
, , , ,
, , , . .;
. CASE .
:
,
,
,
;

156

6.

. CASE-
,
, - /
, , ,
, ,
. .
, (
), . .;
. CASE-
() ,
,
;
.
( ,
). CASE-
, ,
(,

,
);
. CASE-

, ;
.

85-90% .
. CASE-
, .

,
,
. .
CASE- .
CASE- ,

:

,
;
CASE-,
;

().

1 57



.
. CASE-
Power Designer
Sybase.


.
.
. , ,
, . . ,
.
. (,
, ), .

. ,
. , ,
, .
.
,
,
, .
. 6.4, .
, .
.
,
. ,
.
.

,
, . ,
,
. ,
,
.
.

,
. . 6.5
. - -

158

6.

;
, ,
.
,
. ,
, .

.610

500
- 2x4x10

. 6.4. :
; ,

. 6.5.


. , ,
. , -, --, .
. 6.6 .
, - -

159

-. , ,
.

. 6.6.

. 6.7 ,
.

. 6.7.

Power Designer
Power
Designer File New.
, , ,
(. 6.8).
,
, .
Dictionary Model Properties. Model Properties
(. 6.9). ,
, -

160

6.

. , , ,
, , .
SSPoweiDesignei DataAichitect - I COM ModeM 1

{$' file g<U Cictanay grange Fame] JJew Ji'noow

G
Gl
X

V
u
L i t * *A
\

i *

d'

j
. 6.8. Power Designer
Model riopeitiex

, " < '

"-i-i

*$&&1&

'

''^-^''

'

' ,

: {
. ,[|NF0RMATI0N_SYSTEM

:U.

'

, ~ [
(PREMIER

, iiBPsmg/K I

~& 'i i^r-'

.. \ ? J7-14

* " > -

-'-

"'-'

**

)'' |

'' fcr^

. 6.9.


|
, ,

161

.
, .
.
Entity Properties. Definition ,
(. 6.10).
Description.
Annotation
. Attributes,
Description,
. - Rules
.
Entity Properties
Dainlion I Duaiption I
Modat

ModeUD

>

]3

jJ

Code,

jtukuis;

jj

L*hot

|Cnnec -- i
|

Aitrbu>e

W fitnewlelabl

Bute j

UK

Cvcf

#*

help

. 6.10.


,
.

. Dictionary List
of Domains. List of Domains,
(, 6.11).
,
, W0RKER_ID (
) BLDG_ID ( ).
(
Number) . -

162

6.

New Name Code


.
Data Type ,
. Standard Data Types,
.
Number Length 4.
List of Domains

i f;;jft:,:v:,T -":;w;-';;,-Ji --<^,,}1


<

DENT
NAME

N12,4
40

. 6 . 1 1 .

Check.
Check Parameters (. 6.12).
Standard Parameters Values
, . ,
.
- Rules
.
Check Paiameters

Domain I0ENT (!
Data i ^ i i

Piednwi

LanglK 4

$band*d Pvemsts j VeWaJm Rule j


Value

List lvalues

Value

M.*munr

Lehet

Maximum

l-l

Dtfft*

Fqmat

*|

* Lcweicaaj P Uppercase

1 j - ^ t e
?,*b*el
fiues

Caned

W*'

. 6.12.

163

List
of Domains Describe Annotation .
,
.



Attributes, Description.
(. 6.13).

-\.^.**#

.
*

J.-

***** --

J 0*Tsr

1SK0RKER 10

N4
<UNDEF>
N4
<UNDEF>

NAME
HOURLY RATE
SUPV ID"

1*

11
t*bel

[
DENT

Checjj |

[ 1[ ,

, ->..

^^

. 6.13.

, ,
,
.
.
Check Check
Parameters.
WORKER W0RKERJD
( ), NAME () HRLY_RATE ( )
. W0RKER_ID Domain
IDENT.
. W0RKER_ID ,
, I.
,
.
8LDG_TYPE ( ) STATUS () BUILDING (
) : ' ' 1 .
, . BLDG_TYPE
('', ''. '', '
') (. 6.14), STATUS 1 3.

164

6.
Check Parameters
Daultm

BIDGJYPE

De>tyf*

ffLDS-TYPE)

P>Kwon

Ungllu 20

5tarrfaidPaai j vhdon Rula |

of vales

||

Majpnum

Ofta*.

Vajo

Labet

l-l

i_r

- 1 itJiOM

Ufi

fornat

" ioweicase " Uppercase

.-j

" CjnnatmoiMy

fiulet

. 6.14.


:
1. , - 0
, .

2. .
,
Relationji, .
.
(. 6.15),

. Name, Code Label ,
. Cardinality : -, --, -- --.

, . ,
, Min .
Mandatory , ,
.
Mandatory

+3
-<3

165

B^S^jOejcti^JAjwijf^onf

p..' ;;

> ' -,1


#*

,'. #aaei!,|SK ILL.WORKER

j j j CM&

|i

JSKILL.WORKER

J.sbrt -I

? fiijndatoiii

'

Mm j l

Mr | -

'&* IO"DWUI*>MOCTK"

R<* j
gate*

| ,
!

-' .
,

OK-

"'", 7 geawate '


Osnoel

- j -

'

He'-\

. 6 . 1 5 .


. , ASSIGNMENT
WORKER BUILDING .
ASSIGNMENT
WORKER BUILDING.
Dependent.
-- Dominant,
.
. 6.16
.


CASE-
. Dictionary Check Model
,
. .
Check Model Messages (. 6.17).

. , .


CASE-
. -, .

166

6.

-SUPV WORKER

JL
WORKER
WORKER ID
NAME
HRLY RATE

M
A20

N4

SKILL WORKER

BUILDING
BLDG-ID
N
BLDG_ADDRESS Va100
BLDG_TYPE
A20
QLTYJ.EVEL
1
STATUS
I

BUILDING ASSIGNMENT

ASSIGNMENT

-Kh START DATE


WORKER ASSIGNMENT

NUM DAYS

D
I

SKILL
SKILL TYPE
BONUS_RATE
HPS PER WEEK

M
N
N4

. 6.16.
; Check Model Message

\ UBG* \

(heckng Entities
The 'dowing erititns do not have a relatonship
> Enirty ENT_- V
he following entities do not have any attributes
> Entity E N T J 0 7

warning
E (

He

"3

Checking Relationships...
Checking Inheritances...
1 efrorfsl 1 wamingfs].

Poctrpton

"3
Suggestion

. 6.17.

Power Designer File Print Graphics



- .

, ,
. File Create
Report. .

167

,
.
(. 6.18),
,
- , .
,,

:< < *f *!%i*ixi*i*n>i*ijti -.


^'&

fe Title
Text Paragraph

Text Fib

:'

Page S reek

fe

Submodel

'

- fjj Page Break

;- GrPh

-J

[gij Page Break


f

j l ) Model Description

'-! QSi Title Entity Information

j l ] Model Annotation

Title-Lists of objects

]$} Entity Card

f] Domain List

;-.J) Entity Rule List

Data Item List

Entity List

'[ [] Entity Annotation

Relationship List

\-

ffl

$ ^

Business Rule Card

Entity Description

;
*,

Entity Attribute List


Entity Attribute - Data Item * I T E M *

i_

'-.

'+ . Relationship- Relationship LITEMS;

] Business Rule Server Expression

Page Break

-' % Title-Relationships Information

Business Rule Client Expression

- - ^ J 111*

] Business Rule Description

',M,

(-; Q 2 Entity Entity E M *

Business Rule List

Business Rule

Jfcl

j - S3 G,a P h

t*i ^

Inheritance List

, I 'nnrii

OS Title-Globalmodel Graph

3 Model Card

[-, QflJ Submodel - Graph of submodel SJSUBMODELX

W} Graph

-- -

-, ( & Title-CDMGraphes
F

..-.'

*]

* PageBieak
*

iilc^... ~~

..

.J

. 6.18.

JData Item %ITEM%


frsertttemUM

OK

Cansel

. 6.19.

,
.
. ,
, , .
Edit
(. 6.19).
,
, ,
(. 6.20).

168

6.

Name
Code
Label
Type
I

*
X
X
X
X
X

W**&
45 %
45%
40 mm
10%
10 mm

tm
Cesesl

J
mm

. 6.20.

RTF,
.



, .

.
:
.
;
,
, ;

. ,
,
( );
-- -- .
,
;
( ) ;
-- ,
(
).
Power Designer
Dictionary Generate Physical Model. Generating Physical
Data Model (. 6.21), ,
.
, ,
. ,
, .
, .

169

Generating Physical D a t a Model

"3.

(ORACLE Veisran 7 3
POMSeremer

jD \BOOK\DB\NEW\db_model PDM

r tettes
> P

Pieseives8diii>6os

'

Dentate dggaf&ton

fiiCindemiai;

J*TABLE*_PK"

(ndsxihtMtiote

haakm6det

TisMe-

'

fWewnee
}!<*
Update *

(Restrict

Beteletnte:

jRestncI

~3
"3

Tebfepurfss;

~]

. 6 . 2 1 .

-SUPV_WORKER-

WORKER

WORKER ID
<pk> not null
SKILL_TYPE
<fk> not null
WOR_WORKER_ID <fk> null
NAME
not null
HRLY RATE
null
WORKER_PK
SKILL_WORKER_FK
SUPV WORKER FK

BUILDING
BLDG-ID
BLDG_ADDRESS
BLDGJTPE
QLTY_LEVEL
STATUS

<pk> not null


null
null
null
null

BUILDING PK

BUILDING ASSIGNMENT

ASSIGNMENT

SKILL WORKER

BLDG-ID
WORKERJD
START_DATE
NUM DAYS

<pk,fk> not null


<pk.fk> not null
null
null

WORKER ASSIGNMENT
ASSIGNMENT_PK
WORKER_ASSIGNMENT FK
BUILDING ASSIGNMENT FK

SKILL
SKILL TYPE
BONUS_RATE
HPS PER WEEK

<pk> not null


null
null

SKILL PK
. 6.22.

. ,
(. 6.22). -

170

6.

,
.



Database Generate Database.
Parameters (. 6.23),
, , . .
Parameters fai ORACLE Veiiion 7.3
Database .

PREMISS

Je name::

jcrebas sql

"j|jj

W One on!?

ID \BOOK\DB\NEW

Schema | Database j Deltas j


rfatoss
! . .1

Jj

I? Qeate index
; W Deal* table
" Pwykey
-1 ' W &
" Fastjnkay
I
W Feteignkeji,,
T Alternate key
P Dec* integrity . j
j P Mwwtx key -,
P* Diner totae*
Physical cplb
I? tbecfc
P Physics! of**
" Orepnde
|
V Bejjftsciipl
j (/ EMeeq*
! P Comment
, ' f Oieplabfe

" i Vie*
~
.
j ' AS A <~ j j ;
j
1 " Cfeateview
f* Comment
| ' " Orattvie

1i ''
-.
! ; i

:
j

. . ,, 1

" - .

^''^'.

' i F Def** value

'*

j ; P o<*

; ? Comittent
j: -

i ]

j Benaiete .script f frtate database j

Canqal j

Htfr

| '

. 6.23.


Create database.
ODBC;
. :
Generate script ,
.
BUILDING
:
create table BUILDING
(
BLDGJDNUMBER not null.
BLDG_AOORESS
VARCHAR2(100) null
BLDGJ7PE
CHAR(20)
default '' not null
constraint CKC BLDG TYPE BUILDING

171

check (BLDG_TYPE in (''.''.'',' ')),


QLTYJ.EVEL
NUMBER(l)
null
STATUS NUMBER(l)
default 1 not null
constraint CKC_STATUS_BUILDING check (STATUS between 1 and 3).
constraint PK_BUILDING primary key (BLDGJD)
)
/
comment
/
comment
/
comment
/
comment
/
comment
/
comment
/

on table BUILDING is ' '


on column BUILDING.BLDG_ID is ''
on column BUILDING. BLDGJMDDRESS is ''
on column BUILDING.BLDG_TYPE is ' '
on column BUILDING.QLTY_LEVEL is ' '
on column BUILDING.STATUS is ''



. ,
. CASE-

.
,
Database Archive Model.

Database
Modify Database. Parameters, ,
,
.
Generate script. Power Designer
,
.
. , ORACLE 7.3,
, .
,
.
. .
QLTY_LEVEL BUILDING:
alter table ASSIGNMENT
drop constraint FK_BUILDING_ASSIGNMENT
/
create table tmpJUILDING
(
BLDG IDNUMBER not null.

172

6.

BLOG_ADDRESS VARCHAR2(100) n u l l
BLDGJYPE
CHAR(20)
not n u l l .
QLTYJEVEL
NUMBER(l)
null
STATUS NUMBER(l)
not n u l l

)
/
i n s e r t i n t o tmpJUILDING (BLDG_I0, BLDG_ADDRESS. BLDGJYPE, QLTYJEVEL. STATUS)
s e l e c t BLDGJD, BLDGJDDRESS. BLDGJYPE. QLTY_LEVEL. STATUS
from BUILDING

/
drop t a b l e BUILDING cascade c o n s t r a i n t s

/
c r e a t e t a b l e BUILDING

(
BLDGJDNUMBER not n u l l .
BLDG_ADDRESS VARCHAR2(100) n u l l
BLDGJYPE
CHAR(20)
d e f a u l t '' not n u l l
c o n s t r a i n t CKC_BLDGJYPE_BUILDING
check (BLDGJYPE i n ('', '', ''. ' ' ) ) .
STATUS NUMBER(l)
d e f a u l t 1 not n u l l
c o n s t r a i n t CKC_STATUS_BUILDING check (STATUS between 1 and 3 ) .
c o n s t r a i n t PK_BUILDING primary key (BLDGJD)
)
/
comment on t a b l e BUILDING i s

' '

/
comment on column BUILDING.BLDGJD is 'BLDG-ID'
/
comment on column BUILDING.BLDG_ADDRESS is 'BLDG-ADDRESS'
/
comment on column BUILDING.BLDGJYPE i s

'BLDG-TYPE'

/
comment on column BUILDING.STATUS is 'STATUS'
/
insert into BUILDING (BLDGJD. BLDGJDDRESS. BLDGJYPE. STATUS)
select BLDGJD. BLDGJ\DDRESS. BLDGJYPE. STATUS
from tmpJUILDING
/
drop t a b l e tmpJUILDING cascade c o n s t r a i n t s

/
a l t e r t a b l e ASSIGNMENT
add c o n s t r a i n t FK_BUILDING_ASSIGNMENT f o r e i g n key
references BUILDING (BLDGJD) on d e l e t e cascade

(BLDGJD)

,
,
.
,
, , .

II
Delphi

. .
(). ,
- , ,
. ,
- ,
. -
.

.
-
,

.
. -
, . -

.
, -
- (Simula, Smalltalk)
30 .

- .
- : C++, Object
Pascal Visual Basic,
, Pascal QuickBasic.

Object Pascal

175

Object Pascal
Object Pascal,
Delphi Inprise ( Borland).
Object Pascal
,
C++ . Object
Pascal -
, C++.

Object Pascal
, Object Pascal, (
).
. Object Pascal :
Program name_of_program;

Uses
Unitl. Unit2. Unit3;

Label
Label 1. Label 2;

Const
id_constl = valuel;
id_const2 = valeu2;
id_const3 = expression].;

Type
id_typel = type_defl;
id_type2 = typejjef2;

Var

id_varl : type_defl;
id_var2. id_var3 : id_type2:
Procedure procl;


,
Function Fund : type_defl;

begin

end.


Program .
,
Delphi .
, .

176

7. -

Delphi
.

;
.


Uses.
( Object Pascal
). Uses,
.
, ,
, .


Label.
.
/ ,
_.

- ,
Object Pascal, .
, Delphi,
.


Object Pascal
, .
, -
, ,
, .
,
.
.
,
, :

id_typel = integer:


, .

Object Pascal

177

,
.
, .


Var.
, .
Object Pascal ,
Var. , ,
, ,
, . ,
, :
[Hint] Projectl.dpr(8): Variable 'A' is declared but never used in 'Projectl'
,
.

, :
var
id_varl : integer;

:
var
id_varl. id_var2, id_var3 : integer;

,
Var, .
,
.
.


Const.
,
, .
, -
.
, (
,
).
.
,
.
,
.
.

178

7. -

Object Pascal
-, Const.
, -
- . -
,
. -
, .
- ,
,
.
:
const
id_constl - 100:
id_const2 = 100.0;
id_const3 - '100';
id_const4 = (2.5+1)/(2.5-1)
var_constl ; integer = 20;
var_const2 : real = 3.14;

//
//
//
// ,
// -
//
// -
//

Object Pascal
Object Pascal .
-
. , ,
.
, Object Pascal, :
.
,
, .
.
Object Pascal
.
.


,
( ).
: .
: ,
;
(

).

179

Object Pascal


, , ,
.
Q . . Object
Pascal ,
,
.
: - 0 2",
-2" - 1 2"1 1.
Object Pascal . 7.1.
7 . 1 . Object Pascal


Byte

0...255

Word

0...65 535

16

LongWord

0...4 294 967 295

32

Cardinal

0...4 294 967 295

32

Co
Shortlnt

-128...127

Smalllnt

- 3 2 768...32 767

8
16

Integer

- 2 147 483 648...2 147 483 647

32

Longlnt

- 2 147 483 648...2 147 483 647

32

Int64

-2 63 ...2 63 -1

64

.
7- ASCII (American Standard
Code for Information Interchange). 8-
. 8 256 .
128
, ,
,
, ,
.
,
- . 128 ( 128 255)
ASCII.
,
, . . Delphi
ANSI (American National Standards
Institute).

180

7. -

Object Pascal ANSI (8-),


UNICODE (16-). :
AnsiChar Char 8- ANSI;
WideChar 16- UNICODE.

16-
, UNICODE.
, ,
. ,
Microsoft Office.
, True Type
MS Office. , 256
UNICODE ANSI.

.
true () false (). Pascal
Boolean.
1 . Object Pascal
,
:
Boolean ByteBool 1 ;
WordBool 2 ;
LongBool 4 .

true false Object Pascal


.
true false (
). C/C++ Object
Pascal
.

.
,
. ,
, :
type
num_type = ( f i r s t , second, third);

num_type ,
first, second third
num_type. var num_type,
f i rst, second thi rd.

.

Object Pascal

181

. ,
.
:
type
range_type = low_value..high_value;


,
.
.
,
( , , Win
dows 95).
,
(IEEE Institute of Electrical and Elec
tronic Engineers).
(
).
Object Pascal IEEE: Single, Double Extended,
32, 64 80 .
Object Pascal Real,
48 .

. Object
Pascal Real Doubl e,
Real48, 48 .

,

.

Object Pascal
: Currency.
64 -2 6 3 +1 2 6 3 -1.
.
Currency 64 , ,
4 .
.
.
. 7.2
Object Pascal.

182

7. -

7.2. Object Pascal

Single

(1.5-10-45...3.4. )


7...8

,
4

Real48

(2.9 10-39...1.7 )

11...12

Real, Double

(5 10-...1.7 )

15...16

Extended

(3.4 10-...1.1 4932)

19...20

10

-263+1...263-1

19...20

Currency

-922337203685477.5808...
922337203685477.5807

19...20


,
.
, .
, .


.

packed:
type
id_typel = packed array[0..100] of byte:
var
id_varl : id_typel:
id_var2 : packed array[0..200] of char;

Object Pascal :
;
;
;
;
;
.


Object Pascal :
ShortString. String Pascal.
255
256 . ShortString
, 0 255. -

Object Pascal

183

1- 255-.
.
AnsiString.
.
(, IBM PC
232).
4 .
WideString. AnsiString,
WideChar UNICODE,
.

Object Pascal
String. , String,
$. {$+} ( ), String
AnsiString, {$-} ShortString.

Object Pascal, Delphi,


.
,
Pascal.
array,
, of . ,

var
: [1..10] of integer;

1 10.
, ,
. ,
.
.

. ,
10 5 :
var
: [0..9,0..4] of double:


. ,
.
.
.
- :

184

7, -

1. var
.
2. , .
:
type
= array[T)..9] of integer:
var
1.2 : [0..9] of integer:
A3 : array[0..9] of integer;
A5 : MyArray;
A6 : MyArray;

, Al, A3 5 !
, .
1 2, 5 6.
.
,
:
var
: array of char;

,
.
.
, 1 2,
1 :=2
, .
1 2.
.
,

SetLength(var S; NewLength: Integer)
S ; NewLength .
ShortString SetLength
( ) ,
NewLength. NewLength 255.

SetLength
, NewLength, ,
. SetLength
, - ,
,
.
EOutOfMemory.

Finalize
(var S) nil.

Object Pascal

185

.
:
var

: array of array of word;

SetLength
, SetLength (, 10,5).

.
( )
(, SetLength(A.lO) , 10 ).
:
SetLength(A[0].10):
SetLength(A[l],5):
SetLength(A[9].8);

, ,
Finalize(A).

- .
set:
type

NumSet - set of AnsiChar;


var
Al : NumSet;
A2 : set of 0..100;

,
, 0 255.
:
Al-t'A'.'B'.'C'.'O'.'E'];

,
. :
type
MyRecType = record
f i e l d l : integer;
f i e l d 2 . f i e l d 3 : real;
field4 : array[0..4] of char;
end;
var
RecVarl : MyRecType;
RecVar2 : record
f i e l d l : byte;
f i e l d 2 . f i e l d 3 ; extended;
end:

186

7. -

.

: RecVa rl. f i el dl. , with ... do,
.
:
with RecVarl do fieldl:=10;
, case.
, :
var
RecVar = record
fieldl : real:
case byte of
1: numjnt : integer;
2: bytel.byte2.byte3.byte4 : byte
end;

num_int bytel, byte2, byte3, byte4.


. , bytel
i nteger, num_i nt,
byte2 . .

,
.

. .
,
. array
f i 1 . f i 1 of
. , file class.
,
.
Text TextFi 1 . :
var
Fl : file of real; //
F2 : file;
//
F2 : TextFile;
//

, record.
, -

Object Pascal

187

.
- .


,
.
4 (
, 232).
.

poi nter.
, :
var

PI : pointer; //
2 : *real; // real
: : // .
//

.
, - .
, ,
*>. , 1
, 1.

, !

nil.
ni 1
, .
,
.
,
.
Object Pascal, . 7.3.

New Dispose.

Dispose FreeMem
nil. , -
,
nil FreeAndNil, , ,
, GetMem.

188

7. -

7 . 3 .

procedure New(var : Pointer);


, .
.
,
EOutOfMemory

procedure Dispose
(var P:Pointer);

procedure GetMeq
(var P: Pointer; Size: Integer);

Size ,
. ,
EOutOfMemory

procedure FreeMeq
(var P: Pointer [; Size: Integer]);

, .
Size ,
. Size ,

, GetMem

procedure FreeAndNil(var );

, ,
nil


,
, .

variant. 16 .
, .
vari ant ( I nt64),
.
Object Pascal v a r i a n t :
Unassigned ,
, .

;
Nul 1 , .
, ,
VarType. ,
, . 7.4.
Object Pascal
:
function VarArrayCreate (const Bounds:array of Integer; VarType:Integer) : Variant;
,
Bounds, , VarType.
VarType , . 7.4.

189

Object Pascal
7 . 4 .

varEmpty

$0000

Unassigned

varNull

$0001

varSmalllnt

$0002

Smalllnt

varlnteger

$0003

Integer

varSingle

$0004

Single

varDouble

$0005

Double

varCurrency

$0006

Currency

varDate

$0007

varOleStr

$0008

WideString

varDispatch

$0009

OLE Automation, Dispatch

varError

$000A

varBoolean

$000B

Boolean

varVariant

$000C

Variant

varUnknown

$000D

OLE Automation, Unknown

varByte

$0011

Byte

varString

$0100

AnsiString

varArray

$2000

varByRef

$4000

,
A:=VarArrayCreate([0.9].varDouble):

, 10 (
vari ant).
, ,
. , :
A: =VarArrayOeate( [ 0 , 4 ] , varVari ant):

:
[0]
[1]
[2]
[3]

= 1:
= 1234.5678:
= 'Hello world'
= True:.

function VarArrayOf (const Values:array of variant) : Variant;


,
Values. 0,
, Values. ,

A:=VarArrayOf([10. 3.14. 'Text']):
, 3
.

190

7. -

procedure VarArrayRedim (var A: Variant; HighBound: Integer);


HighBound .
, ,
.
function VarArrayLock (var A: Variant): Pointer,-

. ,
VarArrayRedim .
VarArrayUnlock (var A: Variant).

Object Pascal

. , Object Pascal,
: .

.
, .


.
, ': = ',
, .

.


goto ,
; goto I abel 5;. 1 abel
, goto.
, :
labe!5: A:=expression;

goto
.



.
Object Pascal .

Object Pascal

191

if
i f :
if boolean_expression
then statementl
else statement2;

// ,
// boolean_expression = true
// ,
// boolean_expression - false

if else :
i f boolean_expression
then statementl:

/ / ,
// boolean_expression = true

Object Pascal :
> ;
< ;
>= ;
<= ;
= ;
.
, if,
:
not ;
and ;
;
.
,
:
(=0) and (<0) ()

,
.

case
case ... of ,
( ),
case of. .
.
,
, .
end. , .
case ,
:

192

7. -

case ordinal_expression of
1 : statement].: // , ordina]_expression=l
2.3 : statement2 // , ordinal_expression=2
// ordina1_expression=3
end;

case . case
else. , else, ,
.
case charl of
'' : statement].;
// , charl='A'
'D'..'H' : statement3; // , charl
// 'D' ''
else statements
//
//
end;



. Object Pascal .

for
for ... do
. for do (
) :
for i:=init_value to final_value do statement;
for i:=init_value downto final_value do statement;

for
init_value.

to, , , do,
, ,
final_value. , do,
1.
downto, , do, , init_value
, final_val lie;
1.
for , ,
.

while...do
whi 1 ... do .
whi 1 do :
while boolean_expression do statement;
, do, ,
fal se.

Object Pascal

193

, false, ,
do, .

repeat...until
repeat ... until :
repeat
statement!.:
statement2:
statementn;
until boolean_expression:

, repeat until,
, , unti 1,
true.
whi I e ,
, . ,
true, .

while repeat .
false while true
repeat, .
while...do repeat...until.

Object Pascal break


conti nue, :
break .
;
conti nue
. for
.



. one
. , for whi 1
.
begi n end,
:
if a<b
then begin
c:=expressionl;
d:=expression2:
end
else begin

194

7. -
c:=expression3;
d:=expression4;
end:

case i of
1: begin
statement1:
statement2:
end:
2,3: statement3;
end:
for i:=0 to 10 do begin
a:=expressionl
b:=expression2;
end:
while a>b do
begin
a:=expressionl:
b:=expression2:
end:


,
, (
, uses).

:
procedure proc_id(<cnncoK >): //
const //
constl = valuel:
type //
typejdl = type_defl:
var //
varjdl : typejdl:
var_id2, var_id3 : type_def2:
begin
//
end:

procedure,
, (
, ).
, ,
.
.
:
procedure proc_id(pararal:integer:param2:rea1):

195

:
;

;
,
,
:
procJd(A.B);

, , .
, ;

, .

, . ,
,
, ,
.
, ,
, . ,

5.
var
: integer;
procedure (.-integer);
begin
:-10:
end:
:=5:
():

,
(
Stack overflow).

.
, . ,
, ,
4 .
: var

196

7, -

const. -,
-.
- ,
. ,
-
. ,
10:
var
: integer:
procedure MyProcCvar 8:integer):
begin
B:=10:
end;
A:=5:
MyProc(A):

- .
- - :
[Error] Unit2.pas(10): Left side cannot be assigned to

,
:
procedure MyProc(var );


. ;


.

(runtime error).

.

. , ,
:
procedure proc_id(var param:array of typejd);

.

:
high(x) , 1
;

197

low(x) , 0;
SizeOf () .

, .
,
Stack overflow.

,
.
:
function MyFunc(A:integer):single;
begin

end ;

var_idl:=10*MyFunc(var_id2)/var_id3;

, result. , ,
, ,
.
:
function reverse(a:dout>1e) :double:
begin
reverse:=l/double
end:

:
function reverse(a:double):double;
begin
result:=l/double
end;

result .

,
,
, .

,
, .
, , ,
.

198

7. -

Object Pascal
Delphi /. , ,
. ,
, .
, ,
. ,
( ), uses.
Object Pascal :
unit namejofjjnit; //
interface
//
uses
unitl. unit2;
const
constl = valuel:
const2 = expression].;
type
typel = type_defl;
var

varjdl : type_defl:
var_id2 : type_def2;
procedure procjidl;
function funcjidl : type_def2;
implementation
//
uses
unit3. unit4;
const
const3 - value2;
type
type2 - type_def3;
var
var_id3. var_id4 : type_def4;
procedure procl;
begin
end;
function fund : type_def5;
begin
end:
procedure procjidl:
begin
end;
function funcjidl : typejdef2;
begin
end;
initialization
statement1;
statement2;
finalization
statement3:
statement4;
end.

//
//

199

:
uni t ,
.
;
, , ,
, .
i nterf
. uses,
, .
.
;
implementation
, , , .
. , impl mentation ,
. ,
, ;

uses,
implementation.
.

,
, .
.
initial ization.
, uses;
f i nal i zati on.
, ,
. ,
,
. ,
uses.

- ()
.
-
-. ,
, (
). -

200

7. -

.
- -
.
,
Object Pascal.


-
, , .
,
- . ,
,
. , , ,
.
-
.

,
, . , ,
, . , ,
.

Object Pascal cl ass. class


record, -
, . ,
,
. , class
type, :
type
TMyClass = class
fieldl : type_definitionl;
field2 : type_definition2;
procedure methodl;

function method2 : type_definition3:


end;.
var :
var
Objectl : TMyClass:

Delphi .
.

201

, .
, .
.
.
, .

.
,
. .
, ,
.

/ .
.
.
,
- -, .
,
, .

, :
;
Q ,
.
,
.

,
- ,
- . ,
,
, .


-
: , .

,
.
. , -

202

7. -

(). ,
():
, , , . .
, ,
:
type
TCircle = class
. : double:
: double:
function area : double:
function circumference : double:
function inside(x.y:double) : boolean;
end ;

, , .

,
var :
var
Circle : TCircle;

, ,
:

;
wi th.
, ,
:
Circle.x:=5;
Circle.:=20:
Circle.:=10:

with Circle do begin


x:=5;
y:=20;
r:=10:
end;

. ,
, :
A:<ircle.area;

.
, -

203

: ,
. ,
.

, area .
, ,
. , area ,
.


, . , ,
().
:
,
,
. ,
, .
, , ,
, .
: , ,
.
:
TRing = class(TCircle)
2 : double:

function area : double;


function circumference2 : double:
function inside(x.y:double) : boolean:
end:

TRi ng
.
TCi rcl ,
,
. , ,
, ,
.
. .
Object Pascal
class. , ,
, TObject.
:
TMyClass = class
TMyClass = class(TObject)

204

7. -

(
),
,
.
,
. , TCi rcl e
TRing. , Object Pascal,
-,
: -
, . ,
- ,
TCi rcl e,
TRi ng. TCi rcl e TRi ng
, - .
, ,
,
.
,
.
, ,
.

,
, ,
. , ,
. .
,
.
- , .

, .
.
. , ,
, :
TSampleClass = class(TObject) //
FSample : integer;
//
procedure SampleMethod:
//
end;

, ,
- . -

205

,
, .
,
.
property.
,
: ,
( ):
TSampleClass - class(TObject) //
FSample : integer:
procedure SetProp : :
//
function GetProp(NewValue : ); //
//
property SampleProp : read GetProp write SetProp;
end;

:
read ,
; write
, ;


. , , ,
:
function TSampleClass.GetProp : ;
begin
Result:=SampleField:
end;
, :
procedure TMyClass.SetProp(Value ; ):
begin
SampleField:=Value;
end;
GetProp SetProp
Stack overflow ( ).

Q
, /
. ,
( ,
):
SampleObject.SampleProp:=NewValue;
Value:= SampleObject.SampleProp;

206

7. -

.
read w r i t e
( ):
TSampleClass - class(TObject)
FSample : integer:
property SampleProp : TPropType read FSample
write FSample:
end;

,
(,
).

( ),
, (read only).
.
, , ,
;
(write only);
.
default. , default,
:
TSampleClass - class(TObject)
SFld : integer;
property SProp : integer read SFld write SFld; default 10;
end;

.
:
property VProp[index : integer] : TPropType read GetProp write SetProp;
, ,
, .
, , ;
, ,
:
function GetProp(index : integer) : TPropType;
procedure SetProp(index : integer: Value : TPropType);


read wri te
;
default ,
. defaul t,
,
,
. , VProp
default:

207

type
TSampleClass = class(TObject)
property VProp[index:integer] : TPropType read GetP write SetP: default;

end;
var SampleObject : TSampleClass;

:
SampleObject.VProp[k]:=NewValue;
SampleObject[k]:=NewValue;

,
. ,
.
.
, .

-
. .
,
.
.
,
. , ,
.
.


.
.
.
vi rtual dynami .
:

.
(Virtual Method Table, VMT)
(Dynamic Method Table,
DMT) ;
.
.
,
VMT. -
VMT

208

7. -

. VMT
.
VMT ,
, ;
VMT
, .
,
.
, . ,

, .
DMT,
. ,
DMT - ;


override.

.
.
, , :
i 1 = class
. : double:
: double;
function area : double; v i r t u a l ;
function circumference : double;
function inside(x.y:double) : boolean; v i r t u a l ;
end;
TRing = class(TCircle)
r2 : double;

function area : double: override;


function circumference2 : double:
function inside(x,y:double) : boolean; override;
end;

.

, .
.
abstract.
, .
,
.

EAbstractError ( ).
,
, -

209

. ,
.
. TPoint
, ,
.
TPoint = class
. : double;
function area : double; virtual; abstract;
function circumference : double; virtual: abstract;
end;
TCircle = class(TPoint)
: double;
function area : double; override;
function circumference : double: override:
end;


- ,
, , .
-
.
.

.

-. inherited.

Object Pascal (
, ,
). .

.
, .
constructor.
. ,
Create.
. .
destructor.

Object Pascal
, .
, overload.
.
, ,
.

210

7. -

.
.

.


Object Pascal
.
. :
( publ i ). .
publ i ,
, ;
( pri vate). .
, , private .
pri vate
;
Q ( protected). protected,
, , ,
, ;
( publ i shed). publ i shed
.
, publ i shed,
publ i , . , ,
publ i shed, Delphi;
( automated).
.

,
.
- ,
.

. , , TSampl el Sampl :
TSamplel = class(TObject)
private
Field : TPropType;
protected
property Sample Prop : TPropType read Field;
end;.

TSampl 2
, publ i :
TSample2 = class(TSamplel)
public
property SampleProp:
end:

211


,
. , ,
. Object Pascal
.
, ,
Object Pascal Excepti on.
,
. - Exception
.
Object Pascal
.

t r y . . . except
try ... except
. try ... except :
try
statements
statement2;
except
on Excepti onl do staternent3;
on Exception2 do statements
else statements
end:

, try,
, except .
try ,
except. except on ... do,
. on do
. ,
do, .


try.

try... finally
try ... f i nal ly ,
(,
). try ... finally :
try

statements
statement2;

212

7. -

finally
statements:
statements
statements
end:

,
try. ,
, f i nal ly.
try ,
f i nal ly.
,
,
.

raise.

(RAD Rapid Application Development)


.
,
,
,
.

.
RAD
.
,
.
. ,
, . , ,
, , ,
/ ,
.
, ;
( ); (
) .

214

8.

.
, :
, , ,
, , , ,
.
RAD
, :
;
Q ;
.

.
,

.
,
.
,
, ,
.
(, . .)
.
,
,
, .

, .
Microsoft Inprise (
Borland).
:
Microsoft Visual Basic, Visual C++ Visual J++;
Inprise C++ Builder, Delphi JBuilder.

.

Visual C++ C++ Builder


Visual C++ C++ Builder
C++.
.
C++ ,

. , C++

215

,
.

,
, Object Pascal Visual Basic.

Delphi
Delphi Object
Pascal.
C++. Pascal
.
.
Object Pascal - ,
: ,
. C++ Object Pascal
. Object Pascal , C++,

.
Delphi ,
BDE,
ADO, Microsoft. BDE
.
. ,
ODBC. SQL-
SQL Links,
Oracle, Informix, Sybase, DB2 InterBase.
Delphi Object Pascal,
, Inprise, .

Visual Basic
Visual Basic ,
Quick Basic. Visual Basic , Pascal, ,
,
. Visual Basic
- ,
. , , Visual Basic
.
Visual Basic
Delphi, Pascal.
.
Visual Basic
, :

216

8.

Data Access Object (DAO);


32- JET 3.0,
, ,
. Access. JET 3.0

. JET
SQL;

, .

. DAO

, .
Visual Basic ,
Microsoft
.

Visual J++ JBuilder


Visual J++ JBuilder
Java. ( 90- )
. Java .
, Java .
Java- 10-20
.

Delphi
Delphi (
5 Delphi) Inprise
, :

- ;
(Rapid Application Deve
lopment), ;
, (
, ,

);
.
Delphi Object Pascal,
(, ,
) .
Delphi
. (),

217

Delphi

. Delphi
- (Property, Method, Events , , ),
.
Delphi Borland Database Engine (BDE)
(Paradox, dBase, FoxPro)
(Oracle, Sybase, MS SQL Server, InterBase . .).
Delphi (IDE Integrated Development Environ
ment) (. 8.1):
Q ;
;
;
G .

(h

I*

$eafch i f E&W* Sun 1 fcatebsse l<xk

D ! *

\ij&

galp

j<None>

j]

# J --

? i1' > 5Wfsi jAcSflloriatl W?2i Sw*em| !! BatatDnteJsl ADO hrtsBasel Midas j ! loien-liL

S * ^

'..i ^

. 8 . 1 . Delphi

Delphi IDE
Delphi IDE :

, IDE;

218

8,

,
.

.
.
, ,
.
.
.
:
,
, .


, Delphi.
, Delphi
, , , .
,
.


F1.

File
File , .
, , :
Open, Save, Save As, Close, Exit, .
,
.
Open Project Save Project As
. Delphi ,

.
Save All Close All
, .

: New, New Application, New Form New Frame.
(Appli
cation), (Form) (Frame).
New .
New Items (. 8.2), .

219

Delphi

if New Hems
j
N*w

Active

Data Modules
j

*1

Fm*$

'

Application

Component
Control Panel
Application

Contiol Panel
Module

Form

Frame

"'.' >

Console Application

Data Module

Package

Protect Group

'>

C^

. 8.2. New Items

,
(Object Repository). Delphi
. ,
, Delphi, ActiveX . .
,
.
, , ,
New Items.
(, Forms, Dialogs Data Modules)
, .
:
.
, , , ,
. ,
, ,
.
Q Inherited . ,
, ,
. , ,
, , .
Use , .

( ,
).

( Forms, Dialogs, Projects, Data Modules Business).
. Properties

220

8,

,
New Items.
File.
Use Unit
, .
Print .

(. 8.3).
Pnnl Selection
file to wit*
Umtlpes

fjtift pHritmfc ( ion*

" Head/pagnufr)bra
" Urenumtes

PtHteJitjxige
f Dosaalw!)

Uim^ j

["""b"*j|

tmxl |

Sejup -

Cw*l

tteto

. 8.. () ()

Print Form ( ) ,
:
Proportional
PixelsPerlnch;
Print to fit page ;
No scaling .
Print Selection
:
Print selection block ,
;
Header/page number ,
;
Line numbers ;
Syntax print , , ;
Use color ;
Wrap lines ;
Left margin , .

Edit
Edit ,
Windows : Cut (), (), Paste (),

221

Delphi

Delete (), Select All ( ), Undo (), Redo ().



.

Search
,
: Find (), Replace (), Search Again (
), Go to Line Number ( ),
, .
Find in Files
. Find Text (. 8.4).

Find h Rtes I

Qptor*
* fisas ssnste*

; : I? SwtchatfitejmewJK*

Sihofe *

| I

" Ftagutai expressions

j | <* Sehin#tt*iis

feachallgMsnlles

SeaKh !>stttt>Ot>Staw

'

OK

Cancel

. 8.4. Find Text

, .
, Options, :
Case sensitive , / ;
Whole words only ;
Regular expression , ,
(, * ,
).
, Where,
:
Search all files in project ,
;
Search all open files ;
Search in directories .
File mask ,
( ,
Search in directories). Include subdirectories
( ,
Search in directories).

222

8,

Find Error ,
.
Error Adress Find Error
(. 8.5).

. 8.5. ,

Find Error
. ,
, . ,
,
.

View
View .
.
Project Manager (. 8.6),
, .
,
, ,
. , ,
, .
,
, ,
- ,
.


Delphi ( ).
, , ,
.

Translation Manager
.
Object Inspector ,
.
.

223

Delphi
E3

! Project Manager

T ! , .?

[|11 exe

- J
"Path

!j| PFoieclGioupl

X
Remove
'

.
/Mvais
'

D \WinApps\Bcland\Delphi5\Pf0iects

'-'. P Pioject1.exe

i : urnii

DAWirApps\8orland\Delphi5\Pto|ecls
DAWinApps\Borland\Delphi5\Proiects

- g j Unitl.pas
Foml

DAWir*pps\Borlarid\Delphi5\Praiects
DAWir*pps\Boiland\Delphi5\Proiects
DAWirApps\Borland\Delphi5\Pioiects

H J Unit2.pas
:

N*w
' "'

g l Fcm2

DAWinApps\Bodand\Delphi5\Proiecls
DAWinApps\Borland\Delphi5SPcoiecls
DAWinApps\Borland\Delphi5\Praiects

. 8.6. Project Manager ( )

^!^^^^^^1^:
[ [ \\

D:\Win.. AUni(2.pas .

n;a|l.Lll|J!lUlU,Jll!IHI!Lll!l.l,HI

DrV.AUnitl.pas

Exit

<im$(0iwidj

...

.|

terns peodrij

. 8.7.

To-Do List ,
, .
Do Items (. 8.7). ,
, ,
. ,
Do Items, .
.
.
, Add
Do Items. Add To-Do Item
.
Add To-Do Item (. 8.8). Text
, :
(Priority), (Owner), (Category).


,
.

224

8.
9

I**

2*%.
ji

TJ]DW>BB

j*j

OK

j*j
|

Cmcd

'""

. 8.8. Add To-Do Items

Gtobals

Cl*i* | Utlfa

-1 *& t F W
E CJ Inherited
- J Protected
&-\M Public
i+l- Published
} Variables/Constants
' Forml

:
$( J Iflheiitance j Relwancesf
;t] i j Private
:fe 3 Protected
IB' Public
SI PubSshed

. 8.9.

View.
Alignment Palette Align,
, .
Browser (. 8.9),
, , , . .
Properties .
Code Explorer ,
.
, .
(. 8.10).
Component List Components,
(. 8.11).
.
Window List , Delphi
.
Debug Windows .
Desktops
: , .
, View Desktops Set Debug Desktop
Debug desktop,
.

225

Delphi

Unitl.pas
*^^^*^^^^^^f
4fft*Btf
~ 2 Variables/Constants
! j) Formi
- '_J Uses
^ J Classes
> Conttols
Dialogs
;** Forms
: &. Graphics
- Messages
; SysUtSs
' ^ t Windows

M*t \vml

* V -V

type
TForml - class(TForm)
j private
{ Private declarations
public
{ Public declinations
end;

}
}

var

Forml: TForrol;

implement at i on
{$R *.DFM)
end.

ilJ

^<*"*|* "'"" ""

"=-"---<* - -

./

<<*

. 8 . 1 0 .

&*&**
Frames

||^^^^^^^^^^
^

ITAccessFocm

j TAccessHypetlink
~ 1 TAccessReferences
2 S | TAccessReport

^ \ '
. 8 . 1 1 .

Toggle Form/Unit
.
Units , ,
.
Forms , .
Type Library ActiveX, - MTS-.
New Edit Window .
Toolbars .

Project
.
.

226

8.

Add to Project -
(, . .). Add
.
Remove from Project .

, ,
.
Import Type Library Import Type Library (. 8.12),
, .
.
Import Type Library

icmhlter I 0 Type Library (Version l 0)


I CQWebSearch ActiveX Control module (Version 1 0)
IE Popup Menu [Version 1 0)
IE Super Label (Version 1 0)
IE Timer (Version 1 0)
ie2gt 1 0 Type Library (Version 1 01

$u***KM*

'
'

TAdditive
T Distortion

afe$ap95e; (ActiveX

"*j
^

"3

j D \WirApps\B Ofland\D elph64 mpofts

... | j

S . W B * path;

,J ;

]$(DELPHI)\Lib.$(DElPHI)\Bin.$(DELPHI)\lmpoi

P" nte CoispewnWraotwr

. 8.12. Import Type Library

Import Type Library :


Add
;
Remove ,
.

,
.

Class names .
;

Delphi

227

Palette page ,
, , Class names;
Unit dir name , ,
;
Search path ,
;
Install , ,
Class names.
;

,
.

Create Unit ,
, .
Project.
Add to Repository
.
View Source .
Languages ,
.
Add New Project .

.
Add Existing Project
. .
Information (. 8.13).

! 5tsce tompSe4

18 6n

: Codtsd*

2MS32 tytas:

j Pels ;

54C5bi*

j Irtfetslacksiift '

16364 tjiles

INone)

Sims
Rrgiecil Surees*li# CompW,
OK

. 8.13. Information

:
Source compiled ;

228

8.

Q Code size (DLL)


;
Data size , ;
Initial stack size ,
;
File size ;
Package Used , .

Run
Run ,
. 16.
Attach to Process
, (. 8.14).
Delphi .
( Delphi),
.
Attach to Process
Remote ^jsdwte:

Image-
DELPHI32 EXE
EXPLORER.EXE

\m
$FFF2C1BB
IFFF02B7F
$FFF13B7F

D \WINAPPS\B0RIA
CAWINDOWS\
CAPROGRAM FILES\

K.ERNEL32.DLL
LOADWC.EXE
MPREXE.EXE
MSGSRV32.EXE
RunOLL.EXE
SPOOL32 EXE
SYS TRAY EXE
WINCMD32 EXE

SFFCFDFBF
$FFF087A7
$FFF017AF
JFFFFE623
$FFF0B8BB
$FFF2ADD7
$FFF09887
$FFF0SB9F

C:\WINDOWS\SYSTE
C:\WINDOWS\SYSTE
C:\WINDOWS\SYSTE
C:\WINDOWS\SYSTE_
CAWINDOWSS
WINDOWS\SYSTE
WINDOWS\SYSTE
SPROGRAM FILESV * J

FA

1
^

Cwf

K*

. 8.14. Attach to Process

Register ActiveX Server, Unregister ActiveX Server Install MTS Objects


ActiveX MTS-.
Show Execution Point
, .
.
Program Pause ,
.
Program Reset .
Inspect, Evaluate/Modify Add Watch
.

229

Delphi

Add Breakpoint
.

Component
Component
.
New Component .
Install Component Import ActiveX Control
ActiveX.
Configure Palette Palette Properties (. 8.15),
:
, .

Pelsd*
tfftpWert
Name
Additional
Win32
System
Data Access
Data Controls
ADO
InterBase
Midas
InternetExpress
Internet
FastNet
Decision Cube
QRepott
Dialogs
Win 3.1
Samples
ActiveX
Servers
AsW.,J

j Picksgt

^^^^

31^
dclstd50

j y r . TMainMenu
^

TPopupMenu

ddstdSO

TLabel

dclstd50

- *

dclsid50

Jill TMemo

dclstd50

Mi,

dclstd50

TButton

JV ' TTt.~.l,D,-,
U&m

ftiwamft

JS!

,-M|,JRn
j

( >|

l-'i.-hf.

Cancel

M*wal>afJ

>

. 8.15. Palette Properties


Delphi.

Database
.
, .
Explore SQL Explorer,
.
SQL Monitor SQL Monitor,
BDE (Borland Database Engine)

230

8,

.
, , . . SQL Monitor
-.
Form Wizard (Wizard) ,
, ( ).

Tools
Toots ,
Delphi, , . ,
,
(),
.

(. 8.16) ,
.
|

I ' Delphi 5 - Projecll

jrtjWj

. 8.16. Delphi IDE

Delphi : Standard, View, Debug,


Custom, Desktops,
View Toolbars <>
.

Customize (. 8.17), View Tool
bars Customize Customize .

CoBroanrfy
Component
Database
Debug
Edit
Help
Project
Run
Search
Tools
View

*.

Gs&Qp&t..
SjOpertPreiswl,.
HSsve

M$w*&,

"**
Zl

^evePraptfAw
JpJsavftfll
SC, r u *

,*
j*l

To lewwe command busiot. fee of efoctoaQo

. 8.17. Customize

Delphi

231

Customize : Toolbars, Commands Options:


Toolbars ,
;
Commands
. : Categories Commands.
. ,
Categories.
. (drag-and-drop).
,
. ,
Categories,
Commands,
;

, ,
. Delphi IDE
.

Options , ,
.
Show tooltips / ,
Show shortcut keys on tooltips
.

(Component Palette, . 8.18)


, Delphi.

. 8.18. Delphi


,
.
.
, ,
.
Palette Properties (. 8.19),
Properties ( Palette Environment Options).
Delphi 5 Enterprise
19 ,
:

232

8.

1 Palette Properties

x|

Palette]

'< * ***
Additional
Win32
System
Data Access
Data Controls
ADO
InterBase
Midas

~ \

j Parage-

NF>

^^^^H*
4j

TMainMenu

dclstd50

^>

TPopupMenu

dclstd50

TLabel

p b f ' TEdit

em
^

*i
fiefete

TRirti

111i

InternetExpress
Internet
FastNet
Decision Cube
Q Report
Dialogs
Win 3.1
Samples
ActiveX
Servers

JompoBentsj

1*

,1,
|

..

*i

^UiJCO

| '-'("Vv j

ILII

CflW!

Movi>ae

H*

. 8.19. Palette Properties


Standard Windows;
Additional Windows;
Win32 , 32-
Windows 95 Win32s;
System ;

Data Access , ,
, BDE (Borland Database Engine);
Data Controls ,
;
ADO , ,
, ADO (ActiveX Data Object);
InterBase , InterBase
BDE ADO;
Midas
;
InternetExpress web-
;
Internet web-;
FastNet
;
Decision Cube ;

QReport Quick Report;

Delphi

233

Q Dialogs , , . .;
Win 3.1 Windows 3.1 (
Delphi 1);
Q Samples , ;
ActiveX ActiveX;
Servers Micro
soft Office.


F1.


(Object Inspector)

. Object Inspector . 8.20.
1'

I'MI-tilliHW

ZJ

JForml TForml

Actum
AcfiveCoreol ^
AtSft
.,,
BAnctot
AyfoSoioJ
AutoSise
Mode
61<
BodetStyte
BwAaWicftb
tap!*
CJerftHetgt

arWh
tdw
BComijahf*
Cw
VttttM4dtia
OeefcSS*
DiagKfcd
DaeMode
*
JMdert

Evemj

~,. Ji

1 '

]*
j{aH4ufcTopi
|Tw
1 False
jbdWtTOFiigt* .
pbSssSemMnu.b*4
bsSiaaabte
|0
W l .
348
536
j dBlrface
=rrSaeCofi^f aip8Ki

_|
jdmAefiyeEMffi

Cut**
p*f**Moni
poekSia
OiaglSrtd _
OttagModis

tSFonl

HebComaxl
H*te' '
BHeraSoolBs

' " .'

Nan*

; crDefault

fe

_J\J

FomSijte

IFS
UkPias
jdKMaftaa!
|

Forml TFotml
ftgpBttej

PlOjWfcW Jvls|

crDrag
crHandPoint .^
crHelp

||

CfHouGlass ^"f
ciHSpln
CflBeam
ciMultiDrag

J^j
;

, 8.20. , ();
()

Properties
Events. .
, .
,
( ).

234

8.

.
, . .
,
.
Delphi 5
. , Cursor
(. 8.20, ).
:
View , (
, );
Arrange
(by Name) (by Category);
Stay on Top ;
Hide .


(Form Designer)
.
:
;
;
.
10
,
.


,
- . , ,
Events .
- ,
.
,
- .

Delphi .
-,
Object Pascal.


,
. -

Delphi.

235

, Tools Editor Options


Properties .

Delphi.

Delphi
,
. ,
.
( )
, .


Delphi , ,
(Visual Component Library,
VCL).
, , .
VCL
. .

Delphi ,
. .
(DLL),
,
.
:
Q (design-time packages);
(runtime packages).
,
Delphi
(,
). Delphi 5
20 (
BPL ?/Delphi5/Bin).

Packages
Project Options (. 8.21), Project40ptions.

,
. ,
, , . -

236

8.

( 290 ),
.
( 13 ),
,
, .
Packages Project Options (. 8.21).
Protect Options

*((0

CaMpter

Uhk*

Vemonlnte

<f

<*
*

Borland BDE DB Components


Borland Control Panel Applet Package
Borland Database Components
Borland Decision Cube Components
Borland Editor Script Enhancements

gemove

Jyft

fljintirrtepickajjet

|tiMrithKitifflp*cfae*

OK

Caned

. 8 . 2 1 . Project Options

Build with runtime packages ,


, ,
. .
Add,
.



Delphi : (
) ( ).
,
. - ,
, . .
.
.
.
.
,
, .

237

Delphi.

.
Windows , , , Delphi
.
, ,
.

Windows
.
.

Delphi, VCL,
.
.
,
.
. ,
,
, , . . (
!). TForm,
10 .


VCL Delphi ,
Windows.

. Delphi ( )
(TComponent) .

(Button)
Windows.
TButton (. 8.1).
8 . 1 . TButton

Anchors

TAnchors=
set of
(akTop,
akLeft,
akRight,
akBottom)

:
akTop ;
akLeft ;
akRight ;
akBottom .
,

238
8 . 1

8.
()

Caption

TCaption

Cancel

Boolean

true,
Escape OnClick
.
Cancel, true

Default

Boolean

true,
Enter OnClick
.
Default, true

ModalResult

TmodalRes

ModalResult

ModalResult .

Enable

Boolean

true
,

Visible

Boolean

true

Font

TFont

TabOrder

TTabOrder

,
, Tab

TabStop

Boolean

false,

Tab.

Top

Integer

( )
,

Left

Integer

( )
,

TButton .
.
OnClick,
.
. ,

.
1. File New Application .
2. . Object Inspector
Properties , Caption,
Change caption, Exit.
3. Change caption Object
Inspector Events.
OnCl ick.
- OnCl ick:

Delphi.

239

procedure TForml.ButtonlClick(Sender: TObject);


begin
end;

4. ButtonlClick ,
OnClick.
Caption Forml ( TForm,
):
procedure TForml.ButtonlCIick(Sender: TObject):
begin
Forml.Caption: = TlpnMep ';
end:

5. Exit Object Inspector


Events. OnCl ick.

- OnCl i ck :
procedure TForml.Button2Click(Sender: TCbject);
begin
end;

6. Button2Cl ick.
Terminate TApplication (
15 ):
procedure TForml.Button2Click(Sender: TObject):
begin
Appli cati on.Termi nate;
end;

7. .
, , . 8.22, .
Change caption
(. 8.22, ). Exit
.
if

IjChargseajAwd

Ewt

[hstsse - ! J

. 8.22.

(Label)
.
.
Tlabel (. 8.2).
Caption, .
(

240

8.

Object Inspector), . ,
Capti on , ,
.
:
IntToStr , , ;
Fl oatToStr
;
Fl oatToStrF
.
8 . 2 . TLabel

Alignment

TAIignment =
(taLeftJustify,
taRightJustify,
taCenter)

:
taRightJustify ;
taRightJustify ;
taCenter

Layout

TTextLayout =
(tITop,
tICenter,
tIBottom)

:
tITop ;
tICenter ;
tIBottom

Autosize

Boolean

true,
Label ,
, Caption

Transparent

Boolean

true,

Wordwrap

Boolean

true,

.
, , ,
TLabel Caption
.
1. File New Application .
2. . Object Inspector
Properties , Caption,
Change label, Exit.
3. (TLabel).
Caption
"Change label" .
4. OnCl i ck Change I abel:
procedure TForml.ButtonlClick(Sender: TObject);
// -,
//
const i : integer = 0;
begin
inc(i):
//

241

Delphi.
Labell.Caption:=' " +Buttonl.Caption+"' '
end:

IntToStr(i)+' '

OnCl i ck Exit:
procedure TForml.Button2Click(Sender: TObject);
begin
Appli cati on.Termi nate:
end:

.
, , . 8.23, . Change label
"Change Label" 1 .
1. . 8.23,6
5 Change label. Exit
.

t MtiiB'fl ,, Lliangela^i , Hui*d*'d5pa3

"CKanye fabef' *,

j Changs (abefj

. 8.23.

(Check box) .
: ()
(). .
: .
, , ,
, . , ,
Windows .
TCheckBox.
:
Checked: boolean , .
true, ; false,
;
State: TCheckBoxState, : TCheckBoxState = (cbUnchecked,
cbChecked. cbGrayed) : (cbChecked),
(cbUnchecked) (cbGrayed);
Al lowGrayed: Boolean , (true) (false)
.
Caption,
(. 8.24).

242

8.


.
1. File New Application .
2. TCheckBox.
Object Inspector Properties , Caption,
.
.
3. OnCl ick OK:
procedure TForml.ButtonlClickfSender: TObject);
begin
if CheckBoxl.Checked
then Application.Terminate;
end;

4. .
, (. . 8.24).
, .
, .
^1^.B.tfif.jflt

J*f4ue-i* 1*11

W 1 " "porparmtoj

Ok.

. 8.24.

(Radio Button)
.
TRadioButton. Checked
Bool ean, , .
, (, . .),
, .
Caption TRadioButton .

TRadioButton :
. ,
OnClick.

, ,
.
1. File New Application .
2. TRadi oButton.
Object Inspector Properties , Caption, -

Delphi.

243

.
: ,
(. 8.25).
3. OnCl ick OK:
procedure TForml.ButtonlClick(Sender: TObject):
begin
if RadioButton2.Checked
then Beep;
if RadioButton3.Checked
then Application.Terminate:
end:

4. .
, (. . 8.25).
,
.
. ,
.

3vp
{

, 11- n r m W I l

. 8.25.


(Edit box) ,
.
Delphi TEdit. TEdit ,
(. 8.3).
TEdit OnChange,
. ,
OnChange :
procedure TForml.EditlChangeCSender: TObject);
begin
Label 1.Capti on:-Edi tl.Text;
end;

Editl
Label 1.
.
,
:

244

8.

StrToInt (const S: string) .


(
), EConvertError;
StrToIntDef (const S: string; Default: Integer)
. , ,
Default;
StrToFl oat (const S; string) .
,
EConvertError.
8 . 3 . TEdit

AutoSelect

Boolean

CharCase

TEditCharCase =
(ecNormal,
ecUpperCase,

:
ecNormal ;
ecUpperCase
;
ecLowerCase

ecLowerCase)
SelText

String

Text

String

Readonly

Boolean

true,

,



.
TPanel TGroupBox.
Visible
.
.

TPanel
TPanel ,
,
( Bevel Inner Bevel Outer TPanel).

TGroupBox
TGroupBox
. .
.


.
.
: ( ,
) , -
( ).
. ( ,
, , . .) .
, , .

, .
Delphi, ,
: ,
, , . ,
VCL ,
: .

246

9.

Delphi

,
(, , ).
,
. , ,
Delphi Standard Addi
tional .



. :
Al I gnment: 1 i gnment .
:
taLeftJusti fy ;
taCenter ;
taRi ghtJusti fy ;
CaretPos : TPoi nt .
;
Lines : TStri ngs , ;
.
Sel Text.

.

.
. ,
.
, ,
TListBox. :
Col umns: Integer ,
. 0, .
Co1umns>0 ,
Columns ;

Itemlndex: Integer ;
Items: TStri ngs . , ,
;

MultiSelect:
;

Boolean

Delphi

247

SelCount: Boolean ;
Selected [Index: Integer]: Boolean ,
Index ;
Sorted: Boolean
.


.

, .
.
TComboBox. :
DropDownCount: Integer ,
;
DroppedDown: Boolean , ;
Itemlndex: Integer ;
Items: TSt rings ;
MaxLength: Integer ,
;
Sel Text: Stri ng ;
Sorted: Bool ean , ;
Style: TComboBoxStyle .

TImage.
BMP, JPG, WMF ICO.
TImage:
AutoSize:: Boolean true,
;
Center:: Bool ean true,
.
false
;
Pi cture:: TPi cture , TImage;
Stretch:: Boolean true,
, TImage.
Picture
. TPi cture ,
, .
Width Height TPi cture .

248

9,


TPi cture:

procedure LoadFromFi1 (const FileName: string);

procedure SaveToFile (const FileName: string).

, ,
Timage, :
if dlgOpenPi.Execute
then
i mgMyPi .Pi cture.LoadFromFi1e(dlgOpenPi .Fi 1 eName):

(Clipboard)
:

procedure LoadFromClipboardFormat (AFormat: Word: AData: THandle: APalette: HPALETTE);

procedure SaveToClipboardFormat (var AFormat: Word: var AData: THandle: var APalette:
HPALETTE).

AFormat . Windows
: CF_BITMAP,
CF_METAFILE CF_ENHMETAFILE.

:
Bitmap: TBitmap ;
Metaf i 1 : TMetaf i 1 ;
Icon: TIcon (ICO).
,
Graphic TGraphic,
TBitmap, TMetaf i 1 TIcon.

Delphi
Windows
. ,
, .
, ,
. .
VCL Delphi ,
. Dialogs
.

.



. VCL :

Delphi

249

TOpenDialog ;
TSaveDialog ;
TOpenPi ctureDi a 1 ;
TSavePictureDialog .
(. 9.1).
9 . 1 .

DefaultExt

String

,
.
3 .

FileEditStyle

TFileEditStyle =
(fsEdit,
fsComboBox)

.
Delphi

FileName

TFileName

Files

TStrings

Filter

String

Filterlndex

Integer

HistoryList

TStrings

InitialDir

String

Title

String

Options

TOpenOptions

,
:
function Execute : boolean;
,
(OK, Open (), Save ()), Execute
true. Cancel ()
false.
:

OnClose ;
OnFolderChange ;
OnSelectionChange ;
OnTypeChange ;
OnCloseQuery .
;
OnShow .

250

9.

Open ()
, , FileName.
,
.
Files.

, (
). ( , . .)
.

,
. ,
, Filter, String.
,
: . , ,
,
:
'|*.'

,
. :
'|*.;*.'
.
:
'|*.;*.| |*.1'
Filter Editor (. 9.1),
Fi Iter
.

"'\:2'{&:':

"

"pas

dll," exe/ pas

-g

*1

J-/***' j ' 1
. 9 . 1 .

,
.

251

Delphi


( )
(. 9.2).

J Nature
4:041078|pg
S^ 042079 ipg
^e 117050 ipg
% 117058 ipg
4-117077|pg
% 117088 pg

<l

4:129025 pg
4:143028 ipg
%144000 |pg
4:144017|pg
% 144027 pg
4:144051 ipg

*13 &1
4^144066 pg
%144093 ipg
%150050 ipg
3|M5105S|pg

%162007 pg

4:16014|pg
4:18047 pg
% 11003 p<
4:191011
4". 191025 ip<
4:191047 |p(

JLi

j 161063 ipg

*1, JAII ( pg." peg - bmp ico.- emf - wmf]

]jj

. 9.2.


TFontDi a 1 .
. 9.2.
9 . 2 .

Device

TFontDialogDevice =
(fdScreen, fdPrinter,
fdBoth)

Font

TFont

Integer

Integer

MaxFontSize
MinFontSize
Options

TFontDialogOptions

:
OnApply Apply ();
OnClose ;
OnShow .


TColorDialog.
TColorDi a log . 9.3.

252

9.

9 . 3 . TColorDialog

Color

TColor

CustomColors

TStrings


RGB-.
:
Co1orA=ff0000
ColorB=00ff00

Options

TColorDialogOptions

: OnShow
OnClose.


VCL ,
:
TPri nterSetupDi al og ;
TPrintDialog .

. TPri nterSetupDi al og
,
.
TPri ntDial og . 9.4.
9.4. TPrintDialog

Collate

Boolean

Copies

Integer

FromPage

Integer

MaxPage

Integer

MinPage

Integer

Options

TprintDialogOptions

PrintRange

TPrintRange

:
prAIIPages ;
prSelection ;

PrintToFile

Boolean

ToPage

Integer

prPageNums

: OnShow OnCl ose.

Delphi

253

Delphi

. Delphi
,
Delphi .
, , , Delphi,
3,
.
Delphi
BDE (Borland Database Engine).
, BDE.
Delphi
ADO (ActiveX Data Objects),
Microsoft. BDE
.
, , VCL
, .

Delphi
, ,
, : ,
,
. Delphi
: BDE ADO.

BDE
BDE , .
. Delphi
dBase,
Paradox FoxPro, SQL- Oracle, Informix, Sybase, DB2 InterBase.
, ODBC.
:

;
TQuery SQL-,
, .
Data Access .


.
, .

254

9.


. , -
. , ,
.

.
.
,
, ,
.
TQuery TDataSet,

. , ,
. 9.3.
TData

TBDEData

TQuery

. 9.3.

,
. TQuery
11, SQL.
. 9.5.
9.5.

Active

Boolean

, .
true
,

BOF

Boolean

true,

DatabaseName

String

Defaultlndex

Boolean

. true
.
false

EOF

Boolean

true,

Exclusive

Boolean

.
true,

Exists

Boolean

, "
( true, )

FieldCount

Integer

Delphi

255

Fields

TFields

IndexDefs

TlndexDefs

IndexFieldCount

Integer

IndexFieldNames

String

IndexFields:
[Index: Integer]

TField

IndexFiles

TStrings

,
dBase

IndexName

String

KeyExclusive

Boolean

, ,
SetRange.
true, , ,

KeyFieldCount

Integer

, .
0, ,
1 . .

MasterFields

String

MasterSource

TDataSource

,

/

Modified

Boolean

Readonly

Boolean

RecordCount

Longlnt

TableLevel

Integer

, BDE

TableName

TFileName

TableType

=
(ttDefault,
ttParadox,
ttDBase,
ttASCII,
ttFoxPro);

,
. . 9.6.
9 . 6 .

procedure Addlndex
(const Name, Fields : string;
Options: TlndexOptions);

. Name ;
Fields (
); Options
&

256
9 . 6

9.
()

procedure ApplyRange;

procedure Cancel;

procedure CancelRange;

procedure DeleteTable;

procedure Edit;

procedure EditKey;

procedure EditRangeEnd;

.

FieldByName.
Paradox dBase

procedure EditRangeStart;

procedure EmptyTable;

function FieldByName
(const FieldName; string): TField;

function FindKey
(const KeyValues: array of const):
Boolean;

,
, KeyValues.
. true

procedure FindNearest

,
, KeyValues

(const KeyValues: array of const);


procedure First;

function GotoKey: Boolean;

,
.
true. ,
false

procedure GotoNearest;

procedure Insert;

procedure Last;

function Locate
(const KeyFields: String;
const KeyValues: Variant;
Options: TLocateOptions):
Boolean;

, .
KeyFields , ;
KeyValues ; Options .
true

procedure LockTable
(LockType: TLockType);

Paradox dBase

function MoveBy
(Distance: Integer): Integer;

,
Distance. ,
(
, )

procedure Next;

Delphi

257

procedure RenameTable
(const NewTableName: String);

Paradox dBase,

procedure Post;

procedure Prior;

procedure SetKey;


FieldByName
.
StartValues ;
EndValues

procedure SetRange
(const StartValues,
EndValues: array of const);
procedure SetRangeEnd;


FieldByName

procedure SetRangeStart;


FieldByName

procedure UnlockTable
(LockType: TLockType);

,
LockTable



, :
,
;
Q , .
State.
TDataSetState, :
TDataSetState = (dslnactive, dsBrowse, dsEdit. dslnsert.
dsSetKey. dsCalcFields. dsFilter. dsNewValue. dsOldValue.
dsCurValue. dsBlockRead. dsInternalCalc. dsOpening);

.

:
dslnactive ,
. Close
Acti ve false;
dsBrowse ,
. Open
Acti ve true;
dsEdi t .
Edi t.
dsBrowse;
G dslnsert .
Insert. -

258

9.

.
dsBrowse;
dsSetKey .
FindKey.
:
dsNewValue NewValue;
dsOl dVa 1 ue 01 dVaI ue;
dsCurValue CurValue;
ds I nterna 1 Ca 1 ;
dsCalcField OnCalcFields;
dsBlockRead ;
dsFi 1 ter OnFi I terRecord;
dsOpening .


,
. :
, ;
, ;
, .
.

.
:
BeforeCancel, AfterCancel , ;
Bef oreCl ose, AfterCl ose ;
BeforeDelete, AfterDelete ;
BeforeEdit, AfterEdit dsEdit;
Beforelnsert, Afterlnsert ;
BeforeOpen, AfterOpen ;
Bef orePost, AfterPost ;
BeforeScrol 1, AfterScrol 1 .
, , -
, , ,
.
, ,
.
,
:

259

Delphi

Q OnNewRecord .

, .
OnCal cFi el ds (

dsEdit).

ADO
Delphi ,
Microsoft ActiveX Data Objects
Microsoft. BDE
.
BDE.
, ,
ADO .
ADO
ADO .
ADO TADOTable TADOQuery
TQuery.
.
TADOTable.
, TADOTabl e,
Connecti onStri ng.
, . 9.4.

UseOaSe),s*Ffe

F ysegofmasSonSlaifl

v-- 1
j

S#t- [ j

^**fllml

& j

. 9.4.

: Microsoft
Data Link ( UDL) .
ConnectionString
ConnectionString.
,
. Data Link Properties
(. 9.5), ,
.

260

9.
D a t a Link Properties

Seises the tteta yu warf to connect to:


.8
Microsoft Jet 4 0 OLE DB Provide!
Microsoft OLE DB Provider for Oracle
Microsoft OLE DB Provider for SQL Server
Microsoft OLE DB Simple Provider
MS Remote
MSDataShape

&
J

. 9.5. Data Link Properties

:
Provider . MS Access
Microsoft Jet OLE DB Provider,
Microsoft OLE DB Provider for ODBC. dBase, Paradox FoxPro
ODBC;
Q Connection
. . 9.6, .
Microsoft Jet OLE DB Provider Microsoft OLE
DB Provider for ODBC:
Blank password
,
;
Allow saving password
. ,
;
Test Connection
;
Use data source name
ODBC, Use connection string
, ODBC ;
Select or enter a database name
Microsoft Jet OLE DB Provider Use data sourse
name Microsoft OLE DB Provider for ODBC. -

261

Delphi

,
, ,
.
;
, Data Link Properties

Data Link Properties

Provider Conneefejn | Advanced j All

ftovkfer J Advance*) All

Specify lha Mbrang fa cometl ta Access date


1 Seteci a enter xialebase name:

2. Etta uitaelitOT to l>sg i n to da&bAsft

SpepSji the fuSdwsig le connect (a ODBC dels


1. $p*$jfj> the $; of (Mia
< |3TeJ[at"a>ureenaiie]

Refresh |

<"* Us* **< siring

Us*f.J39fn$: j Admin

1
7 filenk passmtd J~ AJbw|ew)Spsoi

XEnierWemMuoniotegoniofhes <V9t
tlsern$me |

" gtanfc pawwwd

1;

-:/-; * ^ ' *

*v

3, Em Ihe jrAial catalog to us

1
I^st Corweclen J

OK

Test Connection (

1 * , ,1, CN*en*

**

. 9.6. : Microsoft Jet OLE DB Provider;


Microsoft OLE DB Provider for ODBC

Advanced ,
,
( ,
, ) ;
G
, ,
Connection.
.
: MSDN Data Access Services, Microsoft Data Access Components (MDAC)
SDK, Microsoft ActiveX Data Objects (ADO), Microsoft ADO Programmer's
Reference, Using Providers with ADO.
,
TADOTabl .
TableName.
TADOTabl e
.

262

9.


,
, . Delphi
,
.
.
Delphi
.
TFi eld, ,
, .

TField
TFi el d

. , TFi el d
,
.
TFi el d . 9.7.
9 . 7 . TField

Alignment

TAIignment

AsBoolean

Boolean

AsCurrency

Currency

Currency

AsDateTime

TDateTime

AsFloat

Double

Aslnteger

Integer

AsString

String

AsVariant

Variant

Calculated

Boolean

: (true) (false)

CanModify

Boolean

, (true) (false)

ConstraintErrorMessage

String

CurValue

Variant

, ,

( )

CustomConstrainl

String

SQL,

DataSet

TDataSet

DataSize

Word

263

Delphi

Datatype

TFieldType

DefaultExpression

String

SQL,

DisplayLabel

String

DisplayText

String

FieldKind

TFieldKind

:
fkData , ,
;
fkCalculated ;
fkLookup ;
fklnternalCalc ,
,
;
fkAggregate

IslndexField

Boolean

, (true)
(false)

IsNull

Boolean

, - (false)
(true)

KeyFields

String

Lookup

Boolean

,
(true) (false)

NewValue

Variant

OldValue

Variant

Readonly

Boolean

ValidChars

TfieldChars

Value

Variant

Visible

Boolean

TFi el d ,
. :
procedure Assign (Source: TPersistent)
Value Source.
;

procedure AssignValue (const Value: TVarRec) Value;

procedure CI ear NULL;

function IsBlob: Boolean , BLOB


(Binary Large Object);
function Is ValidCha r (InputChar: Char) : Boolean ,
InputChar;
Q procedure SetFi el dType (Value: TFieldType) .

264

9.



, .
- OnCalcFields .
:
;
;

. AutoCa lcFields
true.
(. 9.7),
Field Editor
.

. 9.7.

New Field
.
(. 9.8), .
Field type Calculated.

I New Field
- Fwfcl properties - '
-

jCalcField

ISPS

jFloat

""

--

exponent' JTablel CalcFi M

~<

- Lookup <teftriior* - -

L>-.-.

< Vf

''-- 1

*3'""'\1..

Cancel

'

. 9.8. New Field

Delphi

265


TField
. :
TStringField . 8192 ;
Q TSma 111 nt Fi el d , Short I nt;
TIntegerField , Integer;
TLa rgeFi eld , Long Int;
TWordField , Word;
TBool eanFi el d , Bool ean;
TFloatField , Double;
TBLOBField , .
, .
,
;
TGraphicField , . BLOB:
, .
BMP;
TArrayField , TArrayField;
TDataSetField , ;
Q TMemoField , .

Delphi


, .
. VCL Delphi
, ,
.
Data Controls .

TDataSource,
Data Access .

TDataSource
TDataSource
.

.
TDataSource
.
.

266

9.

TDataSource BDE.
, BDE, ADO.

TDataSource .
:

AutoEdit: Boolean true,



dsEdit;

DataSet: TDataSet , TData


Source;
Enabl ed: Bool ean ,
, TDataSource;
State: TDataSetState ,
TDataSource;
procedure Edit
dsEdit;
function IsLinkedTo (DataSet: TDataSet) : Boolean ,
T D a t a S o u r c e DataSet.
TDataSource :
OnDataChange ,
TDataSource,
;
OnStateChange ,
TDataSource;
OnUpdateData .


.
,
: , TQuery, T D a t a S o u r c e . .
File New,
Data Module.
, : Components Data
Diagram (. 9.9).
Components
.


Data Diagram ,
.

Delphi

267

I DataModule2
| DrtaModuW
*$ Default (Session)
,~ g DBDEMOS Was)
K | country dbfTablel)
Constraints
DataSourcel
i # & , FieldDefs
S 4 ; Fields
:
" slri IndexDefs

Oli(ii)ner** |#*tS*gla*j

. 9.9.

4 Default {Session}
1 * 4 DBDEMOS Wias}
^ country.db {TableU
Constraints
DataSourcel
FieldDefs
, ^ Fields
&L IndexDefs

^ ^9*[

.,..
1 - CapitaMTslslel
2 - Continent ..
3.. Area
,1Af

3.

DsstaSeweel

LUJ
. 9.10. Data Diagram

Data Diagram (. 9.10)


, ,
.
.
.

uses .

TDBGrid
TDBGrid
. :
, . TDBGrid
. 9.8.
, .
(. 9.11),
TDBGrid.

268

9.

9 . 8 . TDBGrid

Columns

TDBGridColumns

DataSource

TDataSource

DefaultDrawing

Boolean

:
(true) (false).
false,

OnDrawColumnCell OnDrawDataCell

FieldCount

Integer

Fields
[lndex:integer]

TField

,
, (Index)

Options

TDBGridOptions

Readonly

Boolean

(true) (false)

SelectedField

TField

,
,

Seiecteedlndex

Integer

Add New
. ,
, , .
rtoiling DBGiidl.Columns

3!
0
1
2
3

Name
Capital
- Continent
Population

4 Area

. 9 . 1 1 .

,
.
TColumn. . 9.9.
9 . 9 . TColumn

Alignment

TAIignment

Color

TColor

DropDownRows

Cardinal

FieldName

String

Font

TFont

Delphi

269

PickList

TStrings

PopupMenu

TPopupMenu

Showing

Boolean

, (true) (false)

Title

TColumnTitle

Visible

Boolean

Width

Integer

,
,
. .
PickList.
DropDownRows.


VCL Delphi
, , .
, , ,

.
,
, :
DataSource: TDataSource ,
;

DataFi el d: String ,
.

TDBText
.
.
TLabel.

TDBEdit
TDBEdit , TEdit.
TDBText
, .

TDBMemo
,
. ( TMemoField TBLOBField.)
.

270

9.

TDBCheckBox
( TCheckBox)
, .
ValueChecked ValueUnChecked, ,
, . ValueChecked = true
ValueUnChecked = false.
,
, .
ValueChecked,
; Val ueUnChecked,
.

: Val ueChecked,
ValueUnChecked.

TDBRadioGroup
,
.
- , .

.
Items . ,
, Values. ,
Val ues, .
Val ue.

TDBListBox

.
. TDBListBox
TListBox.

TDBComboBox
, ,
. ,
. TComboBox.

TDBImage
,
. TImage,
:
Q AutoDi splay: Boolean true,
,
false, LoadPi cture;

Delphi

271

procedure LoadPicture ;
procedure CopyToCl ipboard ;
procedure CutToClipboard
;
procedure PasteFromCl ipboard .


, ,
,
.
,
.
VCL Delphi TDBNavi gator,
. ,
:
;
;
;
;
;
;
;
;
, ;
.
, TDBNavigator,
Visibl eButtons, TButtonSet.
TDBNavigator
DataSource, ,
.
Conf i rmDel ete, Bool ean,
.
T D B N a v i g a t o r
: procedure BtnClick (index: TNavigateBtn) . index
.
TDBNavigator :
BeforeAction TDBNavigator,
, (
,
);

272

9.

OnCl ick ,
.


VCL.
Delphi, ,
(
, ).
.
:


( );

;
,
,
.
, . ,
,
(, ,
,
, ).
Delphi ,
, WinAPI, -
VCL.
:
();
.



( , ,
). , VCL
, .
Custom,
Protected . (
, )
, Publ i shed
Publ i .

.

273

,
:

, Public Published
(
, ,
Delphi IDE );
,
.


, .
.


,
VCL.
VCL.
.
:

TWinControl;
TCustomControl;
TGraphi cControl;
TComponent.
.
TWi nControl,

.
Handle. , :
G ;
Handle WmAPI.
Handl e ,
. TWinControl.
TWinControl Canvas,
.
, ,
, TGraphi cControl.
, WM_Paint
.
Paint . -

274

9.

, , Windows ,
.
, TgraphicControl, TLabel. , ,
- TGraphi cControl Canvas,
, Canvas ,
. TGraphi cControl Handle.
TCustomControl ( ) TWinControl
TGraphi cControl, Handle, Canvas.
TControl ,
( ).


, (
VCL),
, :
;

;
;
;
;
.


File New Delphi
IDE New Items Component.

(. 9.12).
1 New Component

^:

NewCMnpoiwnl |
|TDBUtBox
; 0*

zl

]TDBListBoxlmg

. * Pages jSamples

~3 .

j ^ l i f e f t i m e jd\winappsSborland\delphi5\Lib\DBListBoxlrng

,[ I

>*pa*S ]$(DELPHI)\Lfo.$(DELPHI)\Bin.$[DELPHI)\lmporls.$(

frtsW

OK

'

t>

. 9.12.

275

:
- Ancestor type;
Class Name;
,
, Palette Page;
Unit file name;
Delphi Search path (
).
,
:
unit DBListBoxImg;
interface
uses
Windows. Messages, SysUtils, Classes. Graphics. Controls, Forms. Dialogs.
StdCtrls. DBCtrls:
type
TDBListBoxImg = class(TDBListBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;
procedure Register:
implementation
procedure Register;
begin
Regi sterComponents('Samp!es'. [TDBLi stBoxImg]);
end;
end.


,
. pri vate
F.
:

;
Q ;

276

9.

,
.
.
: , , ,
, .

(Simple) ,
.
. ,
:
TDBList = class(TCustomListBox)
private
{ Private declarations }
FNumber: double;
FChar: char;
FString: string;
protected
{ Protected declarations }
public
{ Public declarations }
property NumberProp: double read FNumber write FNumber:
published
{ Published declarations }
property CharProp: char read FChar write FChar;
property StringProp; string read FString write FString;
end;

, publ i shed,
. publ i
.

(Enumerated) .

. , ,
:
TEnum = (epFirst, epSecond. epThird);
TDBList = class(TCustomListBox)
private
{ Private declarations }
FNumber: double:
FChar: char:
FString: string:
FEnum: TEnum;
protected
{ Protected declarations }
public
{ Public declarations }
property NumberProp: double read FNumber write FNumber;
published
{ Published declarations }

277


property CharProp: char read FChar write FChar;
property StringProp: string read FString write FString;
property EnumProp: string read FEnum write FEnum;
end;


(Set) , .
+,

true fal se, ,
.
Anchors TForm (. 9.13).
1||!111
jFoiml TForml

Zi

Prawft I Ewsnu |
!
fclAnchas
I
akLetl
afcTop

,aNoft*
i
[akLeft,akTop]

f*U8
Pais*
|
*
|
teaSOfft fd
j AutoSetel
Tu*
i AttoSiae
Febe
j SCiMod
bd*ft"tsR#!l
.
IbSysimMsnu,
* HtpK^rStyle
bsSizMafe
BortetWx! 8
Cspta
faml
CteitRaight 348
1 Cfenteridth 536
oBWaoe
| Color
fflCemSamti
(TSaetansiuMi
j Cwsot
ciDefaiA
^j
%2<

./

. 9.13. -

,
.

(Object) .
-,
+ ( Font),

.
.

- ( )
Object Pascal.

.

278

9.

, ,
,
.
- read wri te

, .

, ,
.
read write.
(
),
.
, .
( ) ( ).
Get,
Set. ,
, , .

read write :
TDBList = class(TCustomListBox)
private
{ Private declarations }
FString: string;
function GetStringProp: string: virtual;
procedure SetStringProp(const Value: string): virtual:
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property StringProp: string read GetStringProp
write SetStringProp:
end:
function TDBList.GetStringProp: string;
begin
result:=FString;
end;
function TDBList.SetStringProp(const Value: string);
begin
FString:=Value;
end:


:
Create Loaded.
. -

279

( )
:
,
;
;
dfm- ;
Loaded;
Q .
, ,
Loaded .

Create Loaded
inherited.
.


.
:
TDBList - class(TCustomListBox)
private
{ Private declarations }
FString: string:
function GetStringProp: string; virtual;
procedure SetStringProp(const Value: string); virtual;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TCoraponent); override;
published
{ Published declarations }
property StringProp: string read GetStringProp
write SetStringProp;
end;

implementation :
constructor TDBList.Create(AOwner:TComponent);
begin
//
inherited Create(AOwner):
//
FString:='Initial Value';
end;


Object Pascal.
: , , ,
.

280

9.

-
. .
, ,
.


.
TNotifyEvent.
, .
,
.
, ,
. ,
. -
On,
, , (, OnDbl CI i ck
-, Dbl CI i ck ).
,
, ,
. ,
protected .
,
, ,
, :
TDBList = class(TCustomListBox)
private
{ Private declarations }
FString: string;
FOnChange: TNotifyEvent;
function GetStringProp: s t r i n g ; v i r t u a l ;
procedure SetStringProp(const Value: string); v i r t u a l ;
protected

{ Protected declarations }
procedure Change; virtual;
public
j Public declarations }
constructor Create(AOwner: TComponent); override:
published
{ Published declarations }
property StringProp: string read GetStringProp
write SetStringProp:
property OnChange: TNotifyEvent read FOnChange
write FOnChange:
end:


:
procedure TDBList.Change;
begin

281


//
// , :
if Assigned(FOnChange)
then FOnChange(Self);
end:


, ,
,
.dcr (Delphi Component Resource).
(res-).
Image Editor, Delphi:
1. Image Editor Tools Image Editor.
2. Image Editor File New Component Resource
File.
3. Resource New Bitmap.
4. Width () Height
() 24, 256 16.
5. , ,
, .


,
.
:
1. Component Install Component Delphi IDE.
Install Component (. 9.14).
ILHfllH-hllliHii
# $ g s * * e s } new paekags j
!n*ferait:

Sswshpefe

|$|DELPHIJ\Lib $(DELPHIJ\Biti.$|DELPHI)\lmpo[ls.$(DELPHI) \Pioiects\BpU

. gacfcage

fitettB

IQV& .

JD \WiMpps\Bortand\Delphi5\lib\dclusr50 dpk

Browse .

jrj

. PE*.3SesSfst$cire jetfbrsa Oemtwerts

OK

Cm&fit

J im ..B M .

. 9.14. Install Component

2. ,
Into existing package.
, Into new

282

9.

package. Package file name (


), .
3. Unit file name , .
4. ,
Install.
.




, .
,
(data-link object).
TDataSource.
TOataLink.
, ,
:
TGn'dDataLink ,
(, TDBGrig);
TMasterDataLink
;
TFieldDataLink ,
;
TNavDataLink ;
TDataSourceLi nk, TLi stSourceLi nk
.



TDataLink ,
:
UpdateRecord
,
, .
;
Acti ve , ,
;
Acti veRecord
;
Q DataSet ,
.

283

TDataLink
TFieldDataLink. :
Edit
. , ,
(true) (f al se).
,
;
Modi f i ed ;
Q Reset . ,
, ;
CanModify; ,
;
Field: ( TField),
;
U FieldName: ,
;
OnActiveChange: Active
, ;
Q OnDataChange ,
.
, ;
OnEdi ti ngChange
;
OnUpdateData
.
.
- (ListBox), ,
, ,
.

. , ,
,
. TLi stBox.
, .
unit DBList:
interface
uses
Windows, Messages. SysUtils. Classes. Graphics. Controls.
Forms. Dialogs. StdCtrls. Db, DBCtrls;
type
TDBList = class(TListBox)
private

284

9,
{ Private declarations }
FDataLink: TFieldDataLink:
function GetDataField: s t r i n g ; v i r t u a l :
function GetDataSource: TDataSource: v i r t u a l :
procedure SetDataField(const AValue: s t r i n g ) ; v i r t u a l ;
procedure SetDataSource(const AValue: TDataSource): v i r t u a l ;
procedure DataChange(Sender: TObject);
procedure UpdateData(Sender: TObject);
protected

{ Protected declarations }
procedure Click; override:
public
{ Public declarations }
constructor Create(AOwner: TComponent): override;
destructor Destroy; override;
published
{ Published declarations }
property DataSource: TDataSource read GetDataSource
write SetDataSource:
property DataField: string read GetDataField
write SetDataField;
end;
procedure Register:
implementation
constructor TDBList.CreateCAOwner: TComponent);
begin
inherited Create(AOwner);
FDataLink:=TFieldDataLink.Create;
FDataLi nk.OnDataChange;=DataChange;
FDataLi nk.OnUpdateData:=UpdateData;
end;
destructor TDBList.Destroy:
begin
FDataLink.OnDataChange:=nil;
FDataLi nk.OnUpdateData:=ni 1;
FDataLink.Free;
inherited Destroy;
end;
function TDBList.GetDataField: string;
begin
result:=FDataLink.FieldName:
end;
function TDBList.GetDataSource: TDataSource:
begin
result:=FDataLi nk.DataSource:
end;
procedure TDBList.SetDataField(const AValue: string);
begin
FDataLi nk.Fi eldName:=AVal ue:
end:
procedure TDBList.SetDataSource(const AValue: TDataSource);

285

begin
FDataLi nk.DataSource:=AValue;
end:
procedure TDBList.DataChange(Sender: TObject);
begin
if FDataLink.Fieldonil
then if FDataLink.Field.Aslnteger<=ltems.Count
then begin
Enabled:=true:
Itemlndex:=FDataLi nk.Field.As Integer
end
else Enabled:=false:
end;
procedure TDBList.UpdateData(Sender: TObject):
begin
if Enabled
then FDataLi nk.Fi eld.Value:=1temlndex:
end;
procedure TDBList.Click;
begin
if FDataLink.Edit
then begin
inherited Click:
FDataLink.Modified:
FDataLink.UpdateRecord;
end:
end;
procedure Register;
begin
Regi sterComponents('Samples'. [TDBList]);
end:

end.
. DataChange
UpdateData OnDataChange OnDataUpdate
TFieldDataLi nk. (DataChange)
(
). (UpdateData)
.
CI ick ,
(TLi stBox). ,
.
TFIel dDataLi nk.
, OnDataChange OnDa
taUpdate TFi el dDataLi nk.
,
TFi el dDataLi nk.

10

, Delphi,
. Delphi
. ,

.
, .

Delphi

,
.
.
,
. .
,
. ,
, Delphi.
TForm (Single Document Interface, SDI) (Multi Document Inter
face, MDI). ,
.
. SDI-
. SDI-
Delphi. MDI-
.

287

Delphi

TForm
TForm
, ,
, ,
.
. 10.1 .
10.1. TForm

ActiveControl

TWinControl

AutoScroll

Boolean

AutoSize

Boolean

true,

,

Borderlcons

TBorderlcon = set of
(biSystemMenu,
biMinimize,
biMaximize, biHelp)

BorderStyle

TBorderStyle =
(bsNone, bsSingle,
bsSizeable, bsDialog,
bsToolWindow,
bsSizeToolWindow)


, ,

BorderWidth

TBorderWidth

Caption

TCaption

ClientHeight

Integer

ClientWidth

Integer

Color

TColor

Constraints

TSizeConstraints

Ctl3D

Boolean

Cursor

TCursor

FormStyle

TFormStyle =
(fsNormal,
fsMDIChild,
fsMDIForm,
fsStayOnTop)

:
fsNormal SDI;
fsStayOnTop SDI,
;
fsMDIForm MDI;
fsMDIChild MDI

Height

Integer

Icon

Tlcon

,

>

288

10.

10.1 ()

Left

Integer

Menu

TMainMenu

Name

TComponentName

TForm

PopupMenu

TPopupMemu

Top

Integer

Boolean

Visible
Width

Integer

WindowState

TWindowState =
(wsNormal,
wsMinimized,
wsMaximized)

:
wsMinimized ;
wsMaximized ;
wsNormal

Tag

Longlnt

BorderStyl e,
:
bsSi zeabl e .
Borderlcons;
bsSingle ,
. Borderlcons;
bsDialog .
. Borderlcons
;
bsNone ;
bsTool Window ;
bsSi zeTool Wi ndow .
, . 10.1,
, .
1 0 . 2 . TForm,

Active

Boolean

, ( )

ActiveMDIChild

Tform

Canvas

TCanvas

(
)

ModalResult

TmodalResult

, ShowModal

MDlChildCount

Integer

( )

Tform

;'- ( )

MDIChildren
[ i : integer]

289

Delphi

TForm ,
(. 10.2).
, ( ).
TForm ,
. TForm . 10.3.
10.3. TForm

procedure Close

CloseQuery , true,

function CloseQuery: Boolean

procedure FocusControl

Control

(Control:TWinControl)
function GetFormlmage : TBitmap

procedure Hide

procedure Print

procedure Release

procedure Show

function ShowModal: integer

TForm - ,
TForm .
34 , .
:
OnActi vate ;
OnCl ick ;
OnDblCl ick ;
OnClose ;
OnCl oseQuery .
, CloseQuery;
OnCreate ;
OnDeacti vate ;
OnDestroy ;
OnPaint ;
OnShow ;
OnKeyPress ;
OnMouseDown ;
OnMouseUp ;
OnMouseMove .
- ,
. -

290

10,

,
,
.
:
1. File New Application.
2. Object Inspector Events
OnCl ick.
- OnCl i ck:
procedure TForml.FormClick(Sender: TObject);
begin

end:

3. FormCl ick ,
OnCl ick.
Caption Forml ( TForm,
). ,
ExeName Appl i cati on:
procedure TForml.FormClick(Sender: TObject):
const first : boolean - true;
// - ,
//
begin
i f f i r s t then begin
Forml.Caption:=Forml.Caption+' - ' +Application.ExeName:
first:=false
end;
end:

4. Object Inspector Events


OnDbl Click.
- OnDbl CI i ck:
procedure TForml.FormOblCIick(Sender: TObject);
begin
end;

5. FormDblClick.
Terminate TAppl i cati on:
procedure TForml.FormDblCIick(Sender: TObject);
begin
Appli cat i on.Termi nate:
end;

6. .
Forml.
. .

Delphi ( Frames).
, -

291

. ,
.

File New Frame.
, .
Frames (
Standard). ,
.
.
,
.
. , ,
Show ShowModal, .



Delphi TForm,
9. TForm ,
, :
TGroup, TPanel . .


File New Form .
.
,
, .
,
, Delphi
.
. , ,

, .

, .


Shift.
.


Delete. Edit
Delete.

292

10.


,
Delphi . ,
.

Align, View Alignment Palette
, Alignment,
Align .


, ,
.
:
Shift, ;
, ,
, (. 10.1).

:: :::j.:]fdlii
- 1

.'. .'.::
..'.'. .

-j

" ''". . '..'.;: . ". ". ".;::::

"

>

'

'

'

'

'

-,

. 1 0 . 1 .


Alignment,
Align (. 10.2),
Align (. 10.3).

. 10.2. Alignment

. 10.3. Align

293

Alignment ,
(Horizontal)
(Vertical). Horizontal
Align, Vertical .
. 10.4.
1 0 . 4 .

No change

He

Left sides

Right sides

Center

Tops

Bottoms
Space equally

Center in window

Space equally
: () ()
.
.


,
.
:
Width ;
Height ;

;
Left
.

. ,
. ,
, -

294

10.

.
.

.
.

Size (. 10.4),
.

rVMth

~--

-Height-;

<*" ^ *

f S(wtojsfl*St
<~ * J
1

Caacal

'

. 10.4. Size

,
(Width) (Height)
. . 10.5.
1 0 . 5 . Size

No change

Shrink to smallest

( )
( )

Grow to largest

( )
( )

Width

Height


Windows ,
.

Tab.
Tab
.
, .
Delphi -

295

. TabOrder,
. , ,
. , TabOrder = 0,
.
TabStop , (true)
(false).


,
, , , ,
.
, 9.
,
.



,
( ).

. VCL Delphi
(, , , ),
, ,
.
, ,
.
.
, ,
TDBNavi gator. ,
, ,
.



, .
:
, Integer;
, , , , , , ,
;
Q TDateField;
Boolean.

296

10.


TDBEdi t.
TDBCheckBox. , TDBNavi gator
,
TLabel, .
:
1. File New Application.
,
.
, MS Access
ADO.
2. ADO ,
TADOTabl . Data Access
TdataSource.
ADO .
TADOTabl e
Sales.mdb.
3. TADOTabl e
ConnectionString .
4. ConnectionString (. 10.5)
Use Connection String Build.
ffmbimple.ADQTablel Connections (ring
Source of &
U$e O s t a y * Fife

"3
I 7 UssEeroecSwi Sniro

OK

Cancel

. 10.5. Connection String

5. Provider Data Link Properties


Microsoft Jet 4.0 OLE DB Provider (. 10.6).
6. Select or enter a database
name Connection Data Link Properties (. 10.7)
0 ( Test Connection,
, ).
, ,
.
7. TADOTabl e Tabl eName
.

297

Data Link Properties

, Data Link Properties

Pitwidai [ t i W f w c t a j Advanced | All

Provide * * * * ) ]AdvKdj Alt

Sslett * e (few yeu war* (* eawea la

Sprefy th* fottahij & Aceass data:


1, S eiec! a sjatabaw .

OLE DB Pfowrfetis!
Microso I Jet 4.0 OLE DB Provider
Microsoft OLE DB Provider lor ODBC Drivers
Microsolt OLE DB Providei for Oracle
Microsolt OLE DB Provider lor SQL Server
Microsoft OLE DB Simple Provide!
MS Remote
MSDataShape

{D \WinApps\Botland\Delphi5\Pro|ectsWccess\sales

2. ( to log on to the databa**


t/ser^jsme jAdmin

P pesid f~ Afow 34Wj password

dest

OK

Cnpew*

. 10.6.

0(4

. 10.7. ,

TDataSource.
, DataSet.
8. DataSet
TADOTable ( ADOTablel).
9.
. . 10.8.

| | '

' : lDBEd1
DBEdit2
;;;;'
DBEdit9

:! "" 5
:-:; ; ::-: ; ; :-;;::|DBEdit6

ViV. :: <**; jDEdit4

;-;|DBEdit8

:; -ixt
. 10.8.

10. (
TDBEdi t TDBCheckBox) (TDBNavi gator)
DataSource.
( DataSourcel)
, .

298

10.

.

. Open
TADOTable, Close .
11. Open OnShow ,
Close OnClose.
10.1.
1 0 . 1 .
unit Unitl;
interface
uses
Windows. Messages. SysUtils. Classes, Graphics. Controls.
Forms. Dialogs. ExtCtrls. DBCtrls. StdCtrls. Mask. Db.
ADODB;
type
TfrmSimple = class(TForm)
Label 1: TLabel;
DBEditl: TDBEdit:
DBEdit2: TDBEdit:
D8Edit3: TDBEdit:
Label2: TLabel:
Label3: TLabel:
DBEdit4: TDBEdit:
DBCheckBoxl: TDBCheckBox;
Label4: TLabel:
DBEdit5: TDBEdit:
DBEdit6: TDBEdit;
DBEdit7: TDBEdit:
DBEdit8: TDBEdit:
DBEdit9: TDBEdit;
ADOTablel: TADOTable:
DataSourcel: TDataSource;
DBNavigatorl: TDBNavigator;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action:TCIoseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSimple: TfrmSimple:
implementation
{$R *.DFM}
procedure TfrmSimple.FormShow(Sender: TObject):
begin

299


ADOTablel.Open;
end;
procedure TfnnSimple.FormClose(Sender: TObject:
var Action: TCloseAction);
begin
ADOTablel.Close
end;
end.

12. .
. 10.9.
1 *?

131

:|1
. * .

jl73024
|

*>**: |25101

((816)025-6128

| , 18

MJ^IfrfHffrl)';^
. 10.9.



.
TDBGrid (),
.
. .
,
.
1. File New Application.
MS Access,
ADO.
2. TADOTabl .
TDBGrid
TDataSource.
, .
3. TDBTable.
Al ign alCl ient.

, .
4. DataSource ,
TDBGrid.

300

10.

, , TDBTable
, . ,

, Open TADOTabl e
Active true.
5. .
Caption . ,
.
,
,
, .
- OnShow OnClose.
. .
, .
6. OnShow
Forml Events.
OnShow. Delphi IDE

- .
( 10.2, FormShow).
7. OnClose,
(. 10.2, FormClose).
10.2.
unit Unitl:
interface
uses
Windows. Messages. SysUtils. Classes, Graphics. Controls.
Forms. Dialogs. Db, ADODB. Grids. DBGrids:
type
TForml = class(TForm)
DBGridl: TDBGrld;
DataSourcel: TDataSource;
AOOTablel: TADOTable;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Forml: TForml:
implementation
{$R *.DFM}

301

procedure TForml.FormShow(Sender: TObject);


begin
ADOTablel.Open
end;
procedure TForml.FormClose(Sender: TObject: var Action: TCloseAction):
begin
ADOTablel.Close
end;
end.

, ,
. 10.10.

. 10.10.

.
. 10.11.

Ifsjisiij | ! 1|1|!*1 ^] i
9600000
'5760000
2880000
'2880000

I
2
3
4

200000
300000
80000

'

4:

3200000:

2400000:
3400000:
3100000:
2800000
7000000
2700000
2000000:

20000
200000
0
50000
0

12

4;
4!
5;
5:
5;
4:
4:

7
8
9
10
11

'
'

10 12.03.92
' 25.0195'

''"
'"

(Memo)
(Memo)
(Memo)
(Memo)

7 25.01.96

(Memo)

8 10 07 95
8:10.07.95
8 10 07.95
9 15.03.99
9 25.01.95
7 01.03.96
' 7 01.03.96

(Memo)
(Memo)
(Memo)
(Memo)
(Memo)
(Memo)
(Memo)

13

4!

2640000:

100000

8:20.01.98

(Memo)

14

4:

2400000:

7 15 03 92

(Memo)

15

3:

3100000 :

50000

6 2410 98

(Memo)

. 1 0 . 1 1 .

, , TDBGrid
.

302

10.

,
, ,
(, MemoBLOB).
, , ,
, .

: TDBMemo, TDBGraphic . .

TDBGrid ,
DefaultDrawing false
OnDrawColumnCell. , ,
.

,
, Columns Editor
TDBGrid (. 9).
, .
.

. ,
,
, TDBGrid.
(. 10.12).

&! *

:: 1 -
;; 2
:: 3
4 -
;: 5
< 6 -

. 10.12.

TDBGrid,
, ,
(. 10.13). ( )
Width TColumn.
(. 10.14).
TDBGri d
,
TDBNavi gator.
,
:

303

. 10.13.
} *.j*

111^^

\##, ^^^;

. ,

5:
4;
4|
5:
4!
4:
4;
5;
5;
5

9600000!
5760000;
2880000!
2880000:
3200000:
2400000:
3400000:
3100000:
2800000:
7000000:

200000
300000
80000
0
0
20000:
200000:
0
50000:
0

10:12.03.92
10 25.01.95
8120.03.95
8:2003.95
7:2501.96
8:10,07.95
8:10.07.95
810.07 95
9:15.03.99
9:25.01.95

4:
4:
4;

2000000:
2640000:
2400000:

0
100000
0:

7:01.03.96
8:20.01.98
7:15.03.92

|::
:; :
;;|!
::||:
[

. 10.14.

;
;
;
.
, TDBNavigator
. Conf i rmDel ete
true.
-
,
.
.
.
- Bef orePost ,
.
Sel ectedFi el d TDBGri d,
, OldValue TField,
.
,
.

304

10.

,
.
. 10.15, - BeforePost
10.3.


?
Cancef

. 10.15.
1 0 . 3 . BeforePost

procedure TForml.ADOTablelBeforePost(DataSet: TDataSet);


begin
if OKBottomDlg.ShowModalomrOK
then
DBGridl.SelectedField.Value:=
DBGridl.SelectedField.OldValue;
end;

TDBGrid ,
, .
,
(. 10.16).

&11|!1 ^

200000!

10:12.03.92

5760000:

300000!

10!25.'01.'5

2880000;

80000:

8:20.03.95

2880000:

0!

"-200195

'%

5'
1
2
3
4

3200000:

0:

7 25 01.96

2400000:

20000:

8:10.07.95

3400000:

200000:

8 10.07.95

8-10 07^95

2800000:

50000:

9 : 15.03.99

7000000:

0;

9^25.01.95

||

. 1 0 . 1 6 .

PickList TColumn.
TStrings
(. 10.17),

PickList.
, ,
.

305

S t n n g List editor

;?!tr

11

?-, | -' 1
. 10.17. TStrings

PickList,
, .
(, ).



.
, .
TPageControl.

TPageControl
TPageControl .
(
TPageControl).
,
.
New Page TPageControl.
Delete Page .
TPageControl . 10.6.
10.6. TPageControl

ActivePage

TTabSheet

ActivePagelndex

Integer

PageCount

Integer

( )

Pages
[Index: Integer]

TTabSheet

, TPageControl.

&

306
1 0 . 6

10,
{)

HotTrack

Boolean

, (true) (false)
,

MultiLine

Boolean

true,
.

Style

TTabStyle=
(tsTabs,
tsButtons,
tsFlatButtons);

(. 10.18):
tsTabs ;
tsButtons ;
tsFlatButtons

TTabSheet.

, .
Delphi.

. 10.18.


sales.mdb, ,
,
, .
: , , . .
.
,
.
,
.
:
1. File New Application.
2. TPageControl, Win32
.
3. New Page TPageControl
.
4. Capti on
. ,

307

5.
6.

7.
8.

. ,
.
TADOTable ( ADO
) TDataSource.
TADOTabl e
Sales.mdb (
, ).
TDataSource:
, .

.
. 10.19.

,
.

9.
.
. 10.20.
<g

>)!!** j 5|*!**< |

JDBEdiC

DBEdit6

DBEd*3

jDBEd7

TeeqwH!
DBEdit9

JDBEd.14

:t.-.LL!,ld-l;,;l

|DBEdil8

r wm

. 10.19.

: *

**< |

: fDBEditIO

: jDBEdnii
: JoBEd*i2

npeMS-|DBEdill3

: !DBEd'115
: JDBEditi

<'..'.':"""-','!
. 10.20.

308

10,

10.
. ,
, ,
.
11. OnShow Open
, OnCl ose CI ose.
10.4.
1 0 . 4 .
procedure TfrmTabbed.FormShow(Sender: TObject):
begin
ADOTablel.Open:
AD0Table2.0pen
End;
procedure TfrmTabbed.FormClose(Sender: TObject;
var Action; TCloseAction);
begin
ADOTablel.Close:
AD0Tab1e2.Close
end;

12. .
. 10.21.



.
.
,

, .
,

.

.


MasterSource
MasterFields .
(master), a
, , (detail).

.
, ,
.

309


.
it?

; |

* J60300G

:
(831)2564216

! J02 12 72

| , 160

H^i'-iH*!"!"}


* [Cigw^i?"_i*f*^f^S|
: (

50399

-;]

: !
: I

3prViate-i

2800000

:]

50000

i
. 10.21.


.
MasterSource
. MasterFields
.
, ( ,
).

, ,
.


(. 10.22),
MasterFields .

(Detail Fields) (Master Fields).

Add. Joined Fields.
, -

310

10.

. Delete.
Clear .
Field Link Destqnei

$astet &

i Ha^fffffi....

JjJ

"1
zi

fe
)

ij<*> \

. 10.22.


.
.
:
1. TDBNavigator
. ,
.
.
, TPageControl.
.
2. . MasterSource
, ,
.
3. .
. .
, . 10.22.
4. .
.


. ,
.

III


11
, ,
, ,
, .

SQL


SQL. SQL
.
, DQL (Data Query Language).
SQL- ,
SQL- (Oracle, Informix, Sybase, InterBase, Microsoft
SQL Server). SQL-
, ,
SQL ( ANSI SQL 92). ,
SQL,
.
SQL
. , SQL,
.
Delphi BDE
SQL, SQL (Local
SQL). SQL 92.
, .
SQL- .
SQL
SQL-.
Delphi 5
SQL- ADO.
ODBC OLE DB.

Delphi, SQL-

313

, Delphi SQL,
.
SQL BDE, Local SQL.

Delphi,
SQL-
SQL- VCL Delphi ,
, :
G TQuery BDE;
TADOQuery ADO.

VCL Delphi
SQL-, TStoredProc, TADOCommand, TADODataSet, TADOStoredProc.
BDE, ADO.

TQuery
TQuery
BDE.
TQuery .
:
, , a TQuery
SQL-.
SQL ,
. TQuery
.
TQuery . 11.1.
TQuery ,
SQL-:
procedure ExecSQL SQL-, SQL.
,
(, INSERT, UPDATE, DELETE CREATE TABLE).

SELECT Open
TQuery.

function ParamByName (const Value: String): TPa ram


;

314

1 1 .

1 1 . 1 . TQuery

Constrained

Boolean

, (false) (true)
,

DataSource

TDataSource

, ,
SQL-

ParamCheck

Boolean

ParamCount

Word

Params

TParams

, SQL-

Prepared

Boolean

, (true) (false)

RowsAffected

Integer

, ,

SQL

[Index: Word]


SQL

TStrings

SQL-

Text

PChar

SQL-, BDE

procedure Prepare BDE .


;
procedure UnPrepare ,
.

TADOQuery
TADOQuery SQL-
ADO.
TQuery, TDataSet.
,
SQL-, .
TADOQuery ,
TQuery.
-.

, TADOQuery SQL . ,
MS Access Microsoft Jet OLE DB,
ODBC, SQL .


SQL-

.
SQL. -

Delphi, SQL-

315

sales.mdb. , ,
MS Access ADO,
TADOQuery.
,
SQL-, :
1. File New Application.
2. TADOQuery ( ADO
) TDataSource.
ADO Data Access
.
3. Sales.mdb. Connecti onStri ng
TADOQuery.

, TADOTabl e,
.

TADOTable TADOQuery ,
.
SQL-, SQL.

4.
SQL .
, . ,
. 11.1. ,
.
5. Code Editor.
(. 11.2), SQL
,
.
5 ding List editoi

18 k**

~T]

SELECT
FROM

if1

Cr*eS

. 11.1. SQL-

316

11.
hmMain ADOQueiyl.SQL
Satj>ain teMsn.APQ8uefi<1.S8L j
|

MM

I SELECT *
FROM

bJJ

iT

. 1 1 . 2 . S Q L -

TQuery SQL-
SQL Builder,
SQL Builder TQuery,
. ,
( ).

6. TDataSource.
, TADOTable DataSet
( ADOQueryl).

.
7. :
,
;
TDBGrid
;
TButton .

. 11.3.
8. TDBGri d
DataSource ( DataSourcel).
.
9. SQL- ,
Open TADOQuery.
,
OnShow .
, SQL,
DBGndl.
10. .
Open OnShow , CI ose
OnClose.

Delphi, SQL-

ImemSQL

317

; ^ l ' - ~ -

*".

; . : - : . ; :

: : . - - : : .

.';'::'

.'
'

':Jl?J

--

: : : :

:::

: : : "

:;

;:: : :;::- :-:-::: ;:

. 11.3.

,
Active ( , Active = false,
Close).

11. OnClick .


. . ,
.
:
; ,
;
memSQL SQL
ADOQueryl;
, Open ADOQueryl.
11.1.
1 1 . 1 .
unit SQLjnain;
interface
Windows. Messages, SysUtils. Classes. Graphics,
Controls, Forms, Dialogs. Grids. DBGrids. Db, ADODB,
StdCtrls. ExtCtrls, DBTables:
type

318

11.
TfrmMain = class(TForm)
ADOQueryl: TADOQuery:
DataSourcel: TDataSource;
OBGridl: TDBGrid;
memSQL: TMemo;
btnExecSQL: TButton;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender; TObject;
var Action: TCloseAction):
procedure btnExecSQLClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
frraMain; TfrmMain;
implementation
{$R *.DFM}

procedure TfrmMain.FormShow(Sender: TObject);


begin
memSQL.Lines.CI ear;
memSQL.Li nes.Assi gn(ADOQueryl.SQL);
ADOQueryl.Open;
end:
procedure TfrmMain.FormClose(Sender: TObject:
var Action: TCloseAction);
begin
if ADOQueryl.Active then ADOQueryl.Close;
end;
procedure TfrmMain.btnExecSQLClick(Sender: TObject);
begin
if ADOQueryl.Active then ADOQueryl.Close;
ADOQueryl.SQL.Clear;
ADOQuery1.SQL.Assign(memSQL.Lines);
ADOQueryl.Open:
end;
end.
12. .
DBGridl ,
sales.mdb (. 11.4).

DQL
, SQL,
SELECT.
.

319

DQL

^
iSELECT >
| FROM

> ^

|111 111|11111
i
2:
3!

*!
51
61
7;

9;
101

2:Quatlro330
2: Toshiba 6200
2 i Lucky 450
3; Delphi 5
3: Borland C 5
3:Microsolt0fficePro97
3;Fractal Design 5.5
1: "Delphi 5 "
1 ;"C++ Buildet 3 "
2:Satellite_330

I J900: | |
3200: 1

2200:1
180: j |
250; : ;:
195-

'.
2 5 ; ;':;;
3 0 : ':'

1000: -:-:.:

. 11.4. SQL-

,
, .
SELECT ,
. ,
SELECT, .
FROM, SELECT
.

SELECT
SELECT FROM
. SELECT
:
SELECT {* | ALL | DISTINCT fieldl, field2
FROM tablel {. table2
tableN}

fieldN}

SELECT ,
:
;
() *;
ALL ( ) ,
, ;
Q DISTINCT
.
SELECT FROM,
(), .
FROM ,
.

320

11.

SELECT
, . ,
, SELECT ,
. ,
: , :
SELECT [ ]. .
FROM

, SELECT ,
, .
, , ,
FROM.

,
(. 11.5).

SELECT [ ]. ,
FROM

! ]

1||11|{11

4 Delphi 5

180

5 Borland C++ 5

250 :

6 Microsoft Office Pro 97

195i

7 Fractal Design 5.5

395i

8 "Delphi 5 "
9 "C++ Builder 3 "
10 Satellite 330

25:
30!
1000:

11 Sateite_330R

1200!

12 Mistral

1800i

'Satellite's)
14 ' S a t e i t i j K O R

"3

']
2000:

15 Microsoft Office 2000

300:

16 Microsoft Office 2000

200:

|||1||:::
. 11.5.

.

.

DISTINCT.
, :
SELECT DISTINCT
FROM

15 16,
Microsoft Office 2000 (. 11.6).

321

DQL

! SELECT DISTINCT
;: FROM

*>**| j

_ Delphi 5
Fractal Design 5 5
Lucky Pro 450
_ Microsoft Office 2000
Microsoft Office Pro 97
_ Mistral
_ Quattro330
SateHrte_330
" Satellite_330 R
Satellite_450
_ SateKile_450 R

*6tJ#H<>1swnr*

"

,p

. 11.6. DISTINCT


SELECT
, WHERE.
SELECT :
SELECT {* | ALL | DISTINCT f i e l d l . field2
FROM tablel {. table2
tableN}
WHERE

fieldN}

SQL, ,
:
;
;
;
Q .

(true false).
true, , false .


SQL
, .
, :
= ,
;
Q <> true,
;

322

11,

(, < >)
,
;

(, <=
>=) ,
. < > <= >=
true, .

,
, 2:
SELECT *
FROM
WHERE =2
. 11.7.
:
SELECT "

:. -ROM
A ' H E R E =2

JKta J
2 Quallro330
2; Toshiba 6200
2 i Lucky Pro 450
2:Satellite_330
32
2:Salei(e_330R
"
10
2iMistial
:
"12
2: Satellite 450
13:
14
2:Satellite_450R
2: Microsoft Office 2000
16

jti*na

900
3200
2200

1000;
1200:
1800:
1800^

||i
fl:

2000
200

'

. 11.7.


,
. SQL
: Is nul I, BETWEEN..AND, IN, LIKE, EXISTS, UNIQUE, ALL, ANY.
IS NULL
IS NULL
NULL. ,
.

.
, , :
SELECT . . . . .
FROM
WHERE IS NULL

. 11.8.

323

DQL

SELECT , , , , ,
FROM
WHERE IS NULL

ftsnpftt [

11 &

; {831J256-4216

| (095)576-5456

; (095)532-1532

] (095)131-7714

013)225-6541 " '

i &

; (044)453-6764

.JAflfifeC

"\ (846)223-4872

:' "

; (044)264-5627

;.

: . , . 172jijij;|

'':'(32}278-7659

I - , . 4

111

. 11.8. IS NULL

BETWEEN...AND
BETWEEN.AND ,
. .
,
, 200 2000.
:
SELECT *
FROM
WHERE BETWEEN 200 AND 2000

, , . 11.9.

l-iPixi

SELECT
FROM
WHERE BETWEEN 200AND 2000

T g ^ a J K # e f ^ w y j ^

[f*?J^J^(E>&j|

1
57

2 Quattto 330

900

3: Borland O * 5

250

'lb:'
111

2iSatsllite_33b

12;'

2:Mistial

'1800:

'"i3T

2iSa(ellile_450

"iebbi

"14;"

2:Satellite_450R

2000:

"15

3 \ Microsoft Office 2000

3: Fractal Design 5.5

2jSatelliteJ330R

395
1000;
1200:

3ob!

. 11.9. BETWEEN ... AND

324

11.

IN
IN ,
.
, ,
:
SELECT . . .
FROM
WHERE IN (''.''.'')

. 11.10.
1

Is SQL
: SELECT , , ,
FROM
WHERE IN ('','','')

*4

| ^

0bftOnHt^j3iSnpeetj j

|$

!
f f j e O a W 1 ! $#

. 11.10. IN

LIKE
LIKE ,
. :
% (
) ;
_ .
,
:
SELECT , . .
FROM
WHERE LIKE '

4 (. 11.11).
,
(816)025-61, :
SELECT , , ,
FROM
WHERE LIKE ' (816)025-61 '

(. 11.12).

325

DQL

:|SELCT . . .
JFR0M
iSWHERE LIKE 'MX'

|! : |111^|||!|

|||1||||11

; (048)034-5874
1(343)232-4542

? (095)131 -7714

1(044)264-5627

'
. 1 1 . 1 1 . LIKE %*

5
SELECT , . .
FROM
WHERE LIKE '(816)025-61_'

8****0|

(816)025-6128

(816)025-6156

jTftflgfrOH

^j&SK-^W&SW^

. 11.12. LIKE _

EXISTS
EXISTS ,
.
.
,
10.
.
EXISTS:
SELECT .
FROM
WHERE EXISTS (SELECT [ ]
FROM
WHERE (.>10) AND
.[ ]=.[ ])

EXISTS SELECT,
,
10.
EXISTS ,
.
. 11.13.

326

11.

SELECT .
FROM
WHERE EXISTS (SELECT [ ]
FROM
WHERE (.
.[ ]*.[ ])

Toshiba 200

3200

Lucky 450

2200

Delphi 5

180

Borland C++ 5

250

Fractal Design 5.5

395"

"Delphi 5 "

^^^

25"

. 11.13. EXISTS

EXISTS ( : UNIQUE,
ALL ANY) SELECT,
EXISTS .
.
U N I Q U E

UNIQUE .
EXISTS.
, , UNIQUE,
.
ALL

ALL
, .
, ,
, , 10,
:
SELECT *
FROM
WHERE UeHa>ALL (SELECT .
FROM
WHERE .>10)

. 11.14.
ANY

ANY
.
ALL ANY, , ,

327

DQL

, 10.
. 11.15.
SELECT FROM
WHERE Uetra>ALL (SELECT
FROM
WHERE .>10|

1%4

2; Toshiba 6200

3200

2: Lucky Pro 450

2200

12
13
14:

2 Mistral

1800:

2: Satellite 450

1800

2 i Satellite_450 R

2000.

2l

. 11.14. ALL

SELECT
FROM
WHERE UeHa>ANY (SELECT .
FROM
WHERE .>10)

2: Toshiba 6200

2 : Lucky Pro 450

|||||||||||
[*

3200
"2200;

31 Delphi 5
3:Borland C++ 5

250:

3iMicroso(t Office Pro 37

15;

7;

3:Fractal Design 5.5

395^

9:

1 ;"C++ Builder 3 "

10:

2;SateBe_330

11:

2:Satellite_330R

12

2 : Mistral

30:
1000'
'1200!
1800 :

. 11.15. ANY



, .

. SQL :
Q AND , ,
. ,
, .
AND
. true,
, ,
true.

328

1 1 .

OR
.

.

.
, 50, 1000:
SELECT *
FROM
WHERE (>50) AND (<1000)

. 11.16.
LuJiliiilttf

SELECT'
FROM
WHERE (>50| <1000]

lllilil

3! Delphi 5
3:BoriandC++5

"250;

3: Microsoft Office Pro 97

7.
"'15:'
16:

900:

2 ] Quattro 330

135

3:Fractal Design 5.5


3] Microsoft Office 2000

395
' 300:

2: Microsoft Office 2000

200

l |1|111

. 11.16.

0R ,
AND. :
SELECT *
FROM

WHERE (<50) OR (>1000)


, 50 1000 (. 11.17).
SELECT
FROM
WHERE <50) OR ()

^^

]}

2:Toshiba 6200

3200
2200

3!

2:Lucky Pro 450

8;

1 ; "Delphi 5 "

9:

1:"C++ Builder 3 "

*.

25
30

11

2 : Satellite 330 R

1200

12:

21 Mistral

1800

13:

2; Satellite 450

1800:

14:

2Satellite 450 R

2000

. 11.17. OR

329

DQL



, .
NOT.
:
IS NOT NULL
NOT BETWEEN
NOT IN
NOT LIKE
NOT EXISTS
NOT UNIQUE


,
, ORDER BY. SELECT
:
SELECT {* | ALL | DISTINCT f i e l d l . field2
FROM t a b l e l {. table2
tableN}
WHERE
ORDER BY f i e l d {ASC | DESC}

fieldN}

ORDER BY (),
, :
ASC , .
(
).
DESC
( ,
).
, ,
:
SELECT . .
FROM
ORDER BY

. 11.18.
ORDER BY ,
SELECT
( *,
). ,

:
SELECT . .
FROM
ORDER BY 3 DESC

. 11.19.

330

11.

SELECT . .
FROM
ORDER BY

1 "C++ Builder 3

30

1 ; "Delphi 5 "

~3

25 :

3; Borland C++ 5

250!

; Delphi 5

180!

3 Fractal Design 5.5

395!

2 Lucky Pro 450

2200!

2;Microsoft Office 2000

200!

3 Moosofl Oflice 2000

300!

8<5

. 11.18. ORDER BY

SELECT . .
FROM
ORDER BY 3DESC

. senooc

jUetw

2 Toshiba 6200

3200

2 Lucky Pro 450

2200.

2 Satellite 450 R

2000

Satellite 450

1300!

2 : Mistral

1800;

2 i Satellite 330 R

1200!

2Satellile_330

10001

2Quattro330

900i

. 11.19. ORDER BY


SQL .
,
,
.
,
, ,
.

SQL ,
, , ,
. SQL
, ,
. .

331

DQL


:
+;
-;
*;
Q /.
:
, .
.
.
,
( ),
, (
), :
SELECT [ ], . . .
*. *,
*-*
FROM

.
. 11.20.

SELECT [ !. , . .
', ",
"-
FROM

^^^|^^8!^^^^!^81^^
2:

610

1;

2600

' 2\
"V

625'
G30 '
645
605

5;
2:
15

5;
2!
15|

'" 7

1025

27

3050:

3050

5200

5200

9375;

9375

4410;

4410

6450-

6450

272250

302500

8200

10250

!
100:

2700

2700

620

20 !

20:

12400;

12400

0;

210

20^

4200;

4200

0:

27

50;

50|

1350:

1350

0;

2670

3^

3|

8010:

8010

0:

13

|||:||11
. 11.20.


, :
ABS ;
ROUND ;
SQR ;

332

11,

G ;
LOG ;
SIN, COS, TAN .

SELECT, ,
(WHERE).

SQL.
(
, SQR,
SQRT).


SQL .
(aliases).
.
.
AS.

,
:
SELECT [ ]. . . .
* AS [ ],
* AS [ ].
*-* AS []
FROM

. 11.21.

SQL.

, .


,
,
, ,
. ,
.

333

DQL

%
SELECT [ ]. . . ,
' AS [ ].
' AS [ ].
"-1, AS []
FROM

ICoa | U a

1;
2!
2:
2:
2!
3!
8!
2!
8!

sanpec I

]3> IflptBiaHO |< jCgMMasait* ] |^


5.
3050
3050
0 ,,,
2!
5200
5200:
0!||!
2600!
2;
15!
9375
9375
0!**
625!
. 15!
7!
4410
4410
0! J
630!
7:
10!
6450!
6450
0!! :
645!
10:
450:
272250
302500
30250!:!
605!
500!
8200:
10250
2050!
8!
1025!
10!
100!
2700
2700
0: :
27!
100!
20:
12400
12400
0!
620!
20!

6,

27:

50!

50:

1350

1350

0:v:

||$|$|||||1||
. 1 1 . 2 1 .

SQL :
COUNT
;
Q SUM ;
MIN ;
;
AVG .
.
,
, .
:
SELECT () AS [ ].
) AS rain.
() AS max,
) AS [ ].
AVG(fTpoflaHo) AS [ ]
FROM

. 11.22.
SELECT COUNT! ) AS [ ].
MlN[npoflaHo)AS min,
MAX(npoaaHo)AS max.
SUMtnpoflawoJAS [ ].
|AVG() AS [ ]
FROM
aswaarwcoaJBW

|
450

S&ftowttrt* |

|^$81;
927
22.609756097561

^ 1
. 1 1 . 2 2 .

334

11.

DISTINCT.
.

, DISTINCT
,
, .



.
SELECT GROUP BY.
WHERE, ORDER BY.
GROUP BY ,
SELECT. (
, ),
GROUP BY
SELECT.
SELECT GROUP BY :
SELECT f i e l d l . field2
fieldN
FROM tablel {. table2
tableN}
WHERE
GROUP BY f i e l d l . field2
fieldN
ORDER BY fieldl {ASC | DESC}

GROUP BY
, ORDER BY.

,
, :
SELECT .
FROM
GROUP BY . .

,
GROUP BY (. 11.23).
,
.
, , (. 11.23),
:
SELECT
FROM
GROUP BY .

(. 11.24).

335

DQL

SELECT .
FROM
GROUP BY ,

hTi'.i'im"'TTr?iWti?inTnTili

& 1

"C++ Builder 3 "


"Delphi 5 "
Lucky Pro 450
Microsoft Office 2000
Mistral
Quattro330
Satellrte_330
Satellite_330R
Satellite_450
Satele_450 R
Toshiba 6200
Borland C+
Delphi 5

:||^(|||;||1
. 11.23.

.1
!8*><>

z!
IIIJepaHO 3 #
. 1 1 . 2 4 .

,
SELECT DISTINCT ORDER BY.
GROUP BY
, , , .

.
, ,
, :
SELECT [ ],
) AS [ ]
FROM
GROUP BY [ ]

. 11.25.
ORDER BY,
SELECT, ,
WHERE.
: ,
10 , :

336

1 1 .

SELECT [ ],
) AS [ ]
FROM
GROUP 8Y [ ]

8 J

||||1||1
5
592:
20

71

70
33
23
7
30
30
85
32

10!
11!
12!
14!
16!
18!
22:

EssSpaHoll
. 1 1 . 2 5 .

SELECT [ ].
SUM(ripoflaHo) AS [ ]
FROM
WHERE
GROUP 8Y [ ]
0RDERBY2DESC

:l^rtrtji"5 : B'Xj|

I !
2!
7!
22!
10!

565
70
32
30

18;
11:

20
20
20
15

6!

1
?

. 1 1 . 2 6 . GROUP BY

SELECT [ ].
) AS [ ]
FROM
WHERE >10
GROUP BY [ ]
ORDER BY 2 DESC

. 11.26.

GROUP BY HAVING.
GROUP BY, ORDER BY ( ).

. ,
HAVING:

337

DQL
SELECT [ ].
) AS [ ]
FROM
WHERE >10
GROUP BY [ ]
HAVING SUM(npoflaHO)>20
. ORDER BY 2 DESC

. 11.27.

SELECT [ ].
SUM(npoflaHO) AS [ ]
FROM
' WHEREnpoaaHo>10
CROUP BY [ ]
: HAVING SUM(npoaaHo)>20
ORDER BY 2 DESC

ft
\

, , '",
, Nl ,f

M w r a ) K f l f l w e c T r a f l O K g n a j ~ *
2
565

"22! ~I""
""10

70

'.'."^
30

.,,

. 11.27. HAVING

HAVING ,
SELECT.

(. 11.27) ,
, :
SELECT [ ],
) AS [ ]
FROM
GROUP BY [ ]
HAVING 5(*)>25000
ORDER BY 2 DESC

, 25 000,
(. 11.28).

GROUP BY, ORDER BY,


SELECT.


, , ,
. SQL ,
. ,
.

338

11,

Uf SQL

SELECT [ ],
SUMfllpanaHO) AS [ ]
FROM
GROUP BY [ ]
HAVING 511(")>25000
QRDERBY2DESC

Sbtn-WlHtfl-b 34fTf'CC I

18| 1
N

21

592

J
J

i|
1S
!

85
30

:'8 3

. 11.28. HAVING

.
:
;
;
.
WHERE,
.


.
(,
, ).
:
SELECT t a b l e l . f i e l d l . table2.field2 {
tableN.fieldN}
FROM t a b l e l . table2 {
tableN}
WHERE tablel.common_fie1dl = table2.common_fieldl
{AND tablel.common_fie1d2 = table2.common_field2}


SELECT ,
. .
,
, .

. ,
, ,
, .
:
SELECT .. ..
., .
FROM ,
WHERE .[ ]=.[ ]

. 11.29.

339

DQL

ilSELECT ., .
|., .
|FR0M ,
IWHERE ..[ ]* ]

-9:

2151

JQT4WTS&

'.

15

'

10
450

M i l l

100

20

20:

50:

3;

15!

15:

'

Jj

mi

1 : $ $ l p a w 41

. 11.29.

.
(. . 11.29) ,
, ,
:
SELECT .. .. .,
.) AS [ ]
FROM .
WHERE .[ ].[ ]
GROUP BY ., ., .

, , . 11.30.
.. .. ..
: SELECT
5(.) AS [ ]
.
!: "ROM
/HERE .[ ]=.[ ]
\
3R0UP BY ., .. .
;

!!
!

; * ^^^^^^
i

jUtgewwtreongKjjnpKJ

5
23: , , :
70: ! !
85: J | !

!!

:!

!!

32: f f !
20! I I

3 0 !

11**

:'!

33:
52! >.
30!

:;.

7 ! <>,;:

-4

. 11.30.

340

1 1 .

,
WHERE .
(. . 11.30) ,
:
SELECT ., .. ..
.) AS [ ].
.
FROM . ,
WHERE (.[ ]=.[ ]) AND
(.[ ]=.[ ])
GROUP BY ., ., .,
.

. 11.31.

SELECT .. ., .,
5(.)6 [ ].
.
FROM . .
WHERE (.[ ]=.[ ]! AND
(.[ ]= . { ])
GROUP BY .. .. .

1!1

]UT4agTBp.

|^^^|^
5 Toshiba 6200

1:Quatlro330

1 : Toshiba 6200

20: Delphi 5
1;Lucky Pro 450

50: "Delphi 5 "

'20:belphi5
10:"C++Builder 3 "
40: Borland C++5
5:Fiactal Design 5.5

. 1 1 . 3 1 .



,
.
,
= WHERE <>,
<, > . .
SELECT t a b l e l . f i e l d l . table2.field2 {
tableN.fieldN}
FROM t a b l e l , table2 {
tableN}
WHERE tablel.common_fieldl <> table2.coramon_fieldl
{AND tablel.common_field2 > table2.common_field2}

. ,
, ,
.

341



, ,
.
OUTER JOIN.
:
, LEFT OUTER JOIN
, OUTER JOIN;
, RIGHT OUTER JOIN
, OUTER JOIN;
, FULL OUTER JOIN
.

WHERE, OUTER JOIN ON:
SELECT t a b l e l . f i e l d l , table2.field2 {
FROM tablel

tableN.fieldN}

LEFT | RIGHT | FULL {OUTER} JOIN table2


ON
(LEFT | RIGHT | FULL {OUTER} JOIN table3
ON }

. ,
:
SELECT .[].
.[]) AS [ ]
FROM LEFT OUTER JOIN
ON .[ ]=.[ ]
GROUP BY .[]

LEFT JOIN,
, ,
(. 11.32).

, .
,
.
, , .
, .
:
Q ;
ORDER BY ;
, ,
;
BETWEEN.

342

11.

SELECT .[],
5(. []) AS [ ]
FROM LEFT OUTER JOIN
ON [ ]=.[ ]
GROUP BY .[]

67;
Delphi 5

65!

Fractal Design 5.5

401

Lucky Pra450

24!

Microsoft Office 2000


Microsoft Office Pro 97

20:

Mistral

";

Quatlto 330
Saleliite_330
Satellite_330R
Sateliile_450

. 11.32.

SELECT :
SELECT {* | ALL | DISTINCT f i e l d l . field2
FROM t a b l e l {. table2
tableN}
WHERE (SELECT f i e l d l { . field2
FROM tablel {. table2
tableN}
WHERE )

fieldN}
fieldN}


.
Delphi 5:
SELECT [ ], . ,
FROM
WHERE [ Toeapa]=(SELECT [ ]
FROM
WHERE ='01phi 5')

,

. , ,
, ,
. ,
, . 11.33.

, , .
SQL.


SQL
. , SELECT,
.

343

ilSELECT [ ]. , ,
ijFROM
JWHERE [KoflTOBapaHSELECT [ ]
FROM
WHERE *'Delphi 5']

10:
11
14;
22;

20
20
10
50

15
20
10
0;

&>MfflqMHTte$gUppQ|

220:
220:
215:
220;

|!1!

. 11.33.

,
, .

. ,

. , ,
.
UNION UNION
ALL ( ANSI).

ANSI : EXCEPT INTER


SECT, .
Local SQL, SQL ODBC
OLE DB, MS Access.
.

,
, :
, ,
( );
, ,
.

UNION
UNION
.
.
,
200 2000. ,
WHERE 0R
:

344

1 1 ,

SELECT *
FROM
WHERE <200
UNION
SELECT *
FROM
WHERE >=2000

, 200,
, 2000. UNION ,
, (. 11.34).

i SELECT: FROM
: WHERE <200
i UNION
I SELECT
: FROM
; WHERE >>2000

f * I j

\1\

i|

jliwe

2.Toshiba 6200

3200

3!

2: Lucky Pro 450

2200

4:

3: Delphi 5

6!

3; Miciosoll Office i=ro 7

8:

1 : "Delphi 5 "

9:

1 : "C++ Builder 3 "

2:

14:

2 Satellite 450 R

180;
"

195:

||

25 i
30:
2000:

If
. 11.34. UNION

UNION ALL
UNION, ,
.
(. . 11.34) UNION UNION ALL, ,
.
, ,
,
. , :
SELECT *
FROM
WHERE >100
UNION ALL
SELECT *
FROM
WHERE <1000

23 (. 11.35),
16 . ,
, ( , 100,
1000),
.

345

SQL
:SELECT
i FROM
; WHERE
i UNION ALL
;SELECT
i FROM
I WHERE <1000

[8"1*> j a n p i f l ^ j

^^

il

In**

1:

2:Quallio330

900

2\

2:Toshiba6200

3200

3!

2 Lucky Pro 450

2200

4!

3: Delphi 5

180 ;

5:

3: Borland C++ 5

250:

Z-.

3 : Microsoft Office Pro 97

195:

7;

3: Fractal Design 5.5

395

\!

11

. 11.35. UNION ALL




ORDER BY. ,
, ORDER BY.
, ,
,
SELECT.
ORDER BY, GROUP BY
, . GROUP BY
HAVING. GROUP BY
.


(view) ,
. ,
(/
).
.
:
, (
)
;

,
.

346

11.


CREATE VIEW.
/
, CREATE VIEW
:
CREATE VIEW _ AS
SELECT ...

,
, SQL. ,
CREATE VIEW .
Open,
SELECT, ExecSQL. ,
( Exec SQL),
. , SELECT
, , ,
Exec SQL. Exec SQL 11.2.
11.2. OnClick Exec SQL
procedure TfrmMain.btnExecSQLClick(Sender: TObject):
begin
if ADOQueryl.Active then ADOQueryl.Close;
ADOQueryl.SQL.Clear:
ADOQueryl.SQL.Assi gn(memSQL.Li nes):
ADOQueryl.ExecSQL;
end;


. ,
.
. , Test,
:
CREATE VIEW Test AS
SELECT .[ ]. ..
.. .
FROM ,
WHERE . [ >. [ ]

.
, :
SELECT *
FROM Test

(. 11.36) ,
, AS CREATE VIEW.
.
, , ,
, :
CREATE VIEW Test2 AS
SELECT .[ ]. .,

347


.. .,
.*. AS [ ]
FROM .
WHERE .[ ]=.[ ]

SELECT
FROM Test

I I . . jttena

| j
220
215
220
270
275:
285!
275:
235!
830;

4 : Delphi 5
4 Delphi 5

Delphi 5
5 : Borland C++5
5 Borland C++ 5
5 Borland C++5
5 Borland C++ 5
5 Borland C++ 5
6:Microsoft Office Pro 97

jd

20
10
0
15
10
20
10
12
0

mi
ill

If;
811:

. 1 1 . 3 6 . Test

.
. 11.37.

SELECT
FROM Test2

|:j

[Quattro330
1 :Quattro330
1 iQuattro 330
1 iQuattro 330
1 iQuattro 330
1:Quattro330
1 IQuattro 330
2! Toshiba 6200
2: Toshiba 6200

. !

2600
2670
2600
2650"

"2675"
2400
"2380
610
625

2;
3!
i:

57
To"
"ioi"
"5;"
15"

5200;
8010:
26001
5300!
13375]
'24OO0I
"23800!

305o]
" 8375:

. 11.37.


DROP VIEW,
:
DROP VIEW view name

348

11.

, , :
DROP VIEW Test
DROP VIEW Test2

SQL (, ODBC MS Access)


DROP VIEW DROP
TABLE.

SQL-
SQL- ,
SQL,
.
SQL-,
.
TQuery, TADOQuery,
, ,
.


TADOQuery,
TQuery, .

SQL-.
:, :
SELECT *
FROM t a b l e j i a m e
WHERE fieldl<:PARAMl

PARAM1.
SQL
Parameters (Params). Para
meters .Count (Params. Count)
. Parameters (Params)
.
SQL-
, :

,
Parameters (Params) ;

DataType TParameter
(TParam);

SQL-

349

SQL-
Items TParameters (TParams),
ParamByName . Items
, .

ParamByName, ,
;
ParamCheck
Parameters
(Params) (ParamCheck = true),
(ParamCheck = false).

, SQL.
TEdi t, edtParaml
edtParam2.
. -
OnCl ick , 11.3.
1 1 . 3 . OnClick

procedure TfrmMain.btnExecQueryClick(Sender: TObject);


begin
if ADOQueryl.Active then ADOQueryl.Close;
ADOQueryl.SQL.CI ear:
ADOQueryl.SQL.Assign(memSQL.Lines):
if ADOQueryl.Parameters.Count>0
then begin
ADOQueryl.Parameters.ParamByName('_).Value:=
StrToInt(edtParaml.Text):
ADOQueryl.Parameters.ParamByName('P_P2').Value:=
StrToInt(edtParam2.Text);
end:
ADOQueryl.Open;
end:

, ,
edtParaml edtParam2.
:
SELECT *
FROM
WHERE (>:_1) AND (<:_2).

: _1 _2.
edtParaml edtParam2 200 (
), 2000 ( ).
, ,
200 2000 (. 11.38).
.
DataSource , , -

350

1 1 .

.
, DataSource.

.
,
SQL-.

SELECT "
:
R 0 M
WHERE (UeHa>:P_P1)AND (<:_2)

I
Exec SQt
npMtp j - p o o
2 J2000

j |8<< |

"' 330

3 : Borland --5

3 Fractal Design 5.5

|Usna

250
395;
1000:

11

2|Satellite_330R

1200;

12

2 .Mistral

1800;

13

2 Satee_450

15

S.Microsoft Office 2000

| 8

900

2-Satellite_33Q

10

2 Qua

M\

1800;
300:

. 11.38.

.
,
.
, :
1. File New Application.
2. : TADOQuery,
TDataSource TDBGrid.
: ADOMaster, ADODetail, dsMaster, dsDetail, DBGMaster,
DBGDetail.
3. (ADOMaster ADODetai 1)
sales.mdb,
ConnectionString.
4. dsMaster ADOMaster,
dsDetai 1 ADODetai 1.
5. DBGMaster DBGDetail
dsMaster dsDetail .
6. SQL ADOMaster :
SELECT *
FROM

351

SQL-

7. SQL ADODetai l , :
SELECT *

FROM
WHERE [ ]=:" "

, ,
.

8. ADODetail
Parameters.

Integer. ( DataType
.)
9. OnShow OnCl ose.
Open :
procedure TForml.FormShow(Sender: TObject):
begin
ADOMaster.Open;
ADODetail.Open:
end:

Close:
procedure TForml.FormCloseCSender: TObject: var Action: TCIoseAction);
begin
ADOMaster.Close:
ADODetail.CI ose:
end:

[ i f SQL join

'
2

"
4
5:
)
7!

8:
9:
10:
* |

4'

,-

jjd

2; Toshiba 6200

3200;

2!Lucky Pro 450

2200! j

;j
|

3! Delphi 5

180|

3! Borland C++ 5

250|:||;

3I Microsoft Office Pro 7

151

3: Fractal Design 5.5

395'!'.::::!

f|

25! ,:x<:

1 : "Delphi 5 "
1: "C++ Builder 3 "

30::

.:!

iooo!:.,,:

^|

|_tJ

705.03.00

20 17.03.00

20:

210

10 26.02.00

20 05.03.00

11 10.01.00

20~21.0t00'

14 "lb.'oioO

10:25.02.00

22 25.03.00

50 30.03.00

15:
20;
10f"
o!

220
220 | |
215 | | i
220
!

!
1

. j:

JJ =:..:::
. 11.39. SQL-

10. .
, -

352

11.

, ,

(. 11.39).
--.
-- .

. ,
.

12

, ,
,
. ,
, . ,
,
.
, ( )
, .
, .
,
, : ,

. , ,
.


- :
,
.
, ,
, .
, , :
, ;
, ;
;
, ;
( );

354

12.

, : ,
, , . .

. ,
, .

, ,
SQL-, ,
. SQL-
,
.


,
, .
:
;
.
,
.
( ).

, .
, ,
, .
,
. ,

, .
( )
, , ,
, .


QuickReport
Delphi Enterprise
, QuSoft.
Delphi Borland C++ Builder.
QReport
QuickReport.

QuickReport

355

, QuickReport
Delphi, Delphi. QuickReport
, Delphi
(, ).

QuickReport ,
Delphi, - .
QuickReport ,
. , QuickReport,
, , .
:
ASCII- HTML QuickReport;
ASCII-, HTML, Excel, RTF Windows Metafile
.

QuickReport
QuickReport
:
TQuickRep,
;
,
;
,
, ,
;
,
.

TQuickRep
TQuckRep,
,
. ,
(. 12.1).
TQui ckRep
. .
TQuickRep ,

TQuickRep.

.
TquickRep :

356

12.

1. File New. .
2. New Report.
3. TQuickReport,
TQuickRep,
.
TQuickRep.


TQuickRep. ,
- ,
.

. 1 2 . 1 . TQuickRep
TQuickRep . 12.1.
1 2 . 1 . TQuickRep

Bands

TQuickRepBands

DataSet

TDataSet

Description

TStrings

ExportFilter

TQRExportFilter

Exporting

Boolean

, (true) (false)

Options

TQuickReportOptions

Page

TQRPage

ShowProgress

Boolean

, (true) (false)

QuickReport

Units

TQRUnits

Zooq

Integer

357

TQuickRep ,
. :
procedure ExportToFi 1 ter(AFi 1 ter : TQRExportFiUer)
, AFi Iter, :
procedure Forml.ButtonCIick(Sender : TObject);
var
Filter : TQRHTMLDocumentFilter;
begin
Filter:=TQRHTMLOocumentFi1ter.Create('REPORT.HTM');
try
Report.ExportToFi1ter(Fi1ter)
finally
Filter.Free:
end:
end:

procedure NewPage -
.
;
Q procedure Prepare . ,
,
. Prepare
QRPrinter . ,

report.rep:
Report.Prepare:
try
Report.QRPrinter.SaveToFile('report.rep'):
finally
Report.QRPri nter.Free:
end:
MyReport.QRPrinter := nil;

procedure Preview ;
procedure .Print ;
procedure PrinterSetup
.
- TQui ckRep
.
:
AfterPreview ;
AfterPrint ;
BeforePrint
;

358

12.

OnEndPage ;
OnStartPage .

TQuickRep
TQuickRep ,
.
:
Options Page TquickRep
;
Report Settings (. 12.2), Report
settings TQuickRep, .
Report Settings
j-Papa-jer"
1 3 WM J2iaiF l,iarh 1297j"

i Margin?"
i Top
110.00

Wt

110.00
, Qw

pooo

Column space

J10.00

f j u r r i * ol caturnt

"3 I10 il

Foot Anal

jPortrait

^1

~3'

Units

rPag*fteme'

j Top

Left

S Bottom
I .
r Bands
!

Rioht

Cote

Changs)

Frame width

F~{

Length

Una

I i Pageneader.

Pace looter

l A

" Swsmarji

i f " Column fcad j

17 PiH last ptpfootef

DetaJbanri

QuGfcflepuri J

Eravi

P(Nfotpafleiad

*Pt*

OK

Cancel

. 12.2.

:
G Paper size
.

Width () Length ();
Margins
, ;
Other ;
Bands : ,
. Print first page header Print last page footer
Page header Page footer
.

QuickReport

359


TQuickRep
, (
, ).
,
(bands). TQuickRep.
, ,
.
Bands TQuickRep,
.
,
,
. . 12.2 ,
.
1 2 . 2 .

PageHeader

.
: ,
. .

PageFooter

Title

. , ,
PageHeader.

ColumnHeader

.
,
PageHeader ( Title ).

Detail

,
( )

SubDetail

, .

GroupHeader

GroupFooter

.
GroupHeader

Summary


( PageFooter)

. 12.2
.
Bands TQUickRep.
, , TQRBand.
. 12.3.

360

12.

1 2 . 3 . TQRBand

AlignToBottoq

Boolean

true,

BandType

TQRBandType

Font

TFont

, ,
. ,
TQuickBep

Frame

TQRFrame

HasChild

Boolean

Size

TQRBandSize

TQRBand , :
function AddPrintable(PrintableClass: TQRNewComponentClass) : TQRPrintable,

.
TQRBand :

AfterPrint ;
BeforePrint .



, ,
.
:
;
, ;
.

, 9
.
,
:

TQRDBText
, , memo- . ,
, DataSet,
DataField. AutoStretch , (true)
(f al se) TQRDBText
memo-;

TQRDBRichEdit ,
, RTF.
DataSet DataField;

361

QuickReport

TQRDBImage ,
BLOB- .
DataSet DataField;

TQRExpr .
,
VCL. Expres
sion.
(. 12.3),

.
. ,
.
. , ,
. 12.4.
Expression Wizaid
,s<pi*ir
SUM(ADOTabtei )

jjawbase field J

gm

fuacaoa

4&1

^aiiabte

1 OR I

t$**>*j

. 12.3.

ResetAfterPrint TQRExpr ,
.
.
1 2 . 4 . ,

+,-,*,/

. +

AND, OR, NOT


>, <, >=, <=, , =

AVERAGE(EXPR)

. ,

COPY(STR,S,L)

STR L, S

COUNT

&

362
1 2 . 4

12.
()

DATE

DIV(X, Y)

X Y

FALSE

false

FORMATNUMERIC(F, N)

N, F.
FormatFloat Object Pascal

FRAC(NUM)

NUM

IF(EXPR,X, Y)

X, Y,
EXPR

INT(NUM)

NUM

LOWER(STR)

STR

MAX(EXPR)

. ,

MIN(EXPR)

. ,

PRETTY(STR)

SQRT(NUM)

NUM

STR(NUM)

SUM(EXPR)

. ,

TIME

TRUE

true

TYPEOF(EXPR)

(, 'BOOLEAN')

UPPER(STR)

TQRLabel TLabel
, (,
);

TQRMemo TMemo
, ;
TQRRichText RTF.
TRichText;
TQRImage ,
( , ,
). TImage;

TQRShape .
. TShape;
TQRExprMemo memo-,
.
, TQRExpr;

QuickReport

363

TQRSysData .
Data :
qrsDate ;
qrsDateTi ;
qrsColumnNo ;
qrsDetail Count , ;
qrsDetai I No ;
qrsPageCount ;
qrsPageNo ;
qrsReportTi t i e ( ReportTi t l e
TQuickRep);
qrsTime .

, .
- .

QuickReport, .

QuickReport ,
:
TQRTextFi 1 ter (ASCII) .
;
TQRCSVFilter CSV-, ,
. ,
.
, Microsoft Excel. Separator
;
TQRHTMLFi Iter HTML (HyperText Markup Language).
QuickReport :
Q TQRExcel Fi l ter MS Excel;
TQRRTFFi Iter RTF;
TQRWMFFi I ter W M F (Windows
Metafile).

TQuickRep.
,
, TQuickRep.

364

12.

,
. ,
.
: TQRLabel,
TQRDBText, TQRExpr, TQRMemo, TQRSysdata TQRExprMemo.

,
. ExportToFilter
TQuickRep (. TQuickRep).



.
:

PAGENUMBER ;

COLUMNNUMBER ;

REPORTTITLE ( R e p o r t T i t l e
TQui ckRep);

APPNAME ;

APPSTARTDATE ;

APPSTARTTIME .


TSysOata.
. , ,

. Functions TQuickRep.

(. 12.4),
.
User Defined Functions Edtoi
AvaJabfe IJ s Drifted .

fcf*w

] Expression

PAGENUMBER

Tl'r'll'lllWI IllWi U

REPORTTITLE

1 \ B*H

Ctoat {

. 12.4.

365

QuickReport


QuickReport
,
QuickReport.
.


,
,
Detail.
sales.mdb.
. :
1. File New Application.
2. TQuickRep.
.
3. .
4. sales.mdb
ADOTabl el.
5. DataSet QuickRepl ADOTabl el.
6. Bands Qui ckRepl,
+, .
HasDetai 1 true.
Detai 1.
7. TQRDBText Detai 1.
8. DataSet TQRDBText
ADOTabl el. DataField TQRDBText
, .

, . 12.5.

UeHi

,,., , .1

^ . 1 1

. 12.5. Delphi

366

12.

, .
Active ADOTablel true,
QuickRepI (
Detail) Preview.
, . 12.6.

I Piinl Pievn.w

'IS&'SJH ^ >

\m&\U&\jfa*\

I
|

~
Quattro 330

800

To$hiba6200

3200

Lu<*y Pro 460

2200

DeiphiS

180

Borland C++ 5

250

MiciQsoft Office Pro 07

186

Fractal Detign 5.5

305

"Delphi 5 t "

25

"C++ Builder 3 * "

Satellrte_330

1000

Satellite 330 R

1200

Mistral

1800

_J

Satellite_460

1800

SjWIKtjWO R

2000

<l

PageteH

.*
/

. 12.6.

, , . ,
Delphi.
, ,

. Preview Print
TQui ckRep. ,
. ,
.
,
.
,
.

QuickReport

367


, :
1. File New Form.
2. Project Options.
Options Forms Form2.
3. Unitl ( )
.
4. ( TButton).
Caption , .
5. - OnCl i ck:
procedure TForm2.Button1!ick(Sender: TObject);
begin
Forml.QuickRepl.Preview;
end:
procedure TForm2.Button2Click(Sender: TObject);
begin
Forml.Qui ckRepl.Pri nt:
end;

6. - OnShow OnCl ose


Open Close ADOTablel:
procedure TForm2.FormShow(Sender: TObject);
begin
Forml.ADOTablel.Open;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction):
begin
Forml.ADOTablel.CI ose;
end;


: .
, .



,
.


Title. ,
, .
, ;
1. Title QuickRepl.
Bands , HasTitie true.

368

12.

2. Ti tl e TQRLabel.
3. Caption QRLabell, ,
.
, ,
(. 12.7).

J aw

< * \'. &- ..*1


Jfc

1
1


Quattro 330

900

Toshiba 6200

3200

Lucky Pro 450

2200

Delphi 5

180

Borland C + + 5

250

**1*

jd

. 12.7.


ColumnHeader .
, Detai 1
Title Bands.HasColumnHeader
QuickRepl true.
TQRLabel . Caption
,
. , ,
, . ,
. 12.8.

Hi

> S i

O ^ i Steel

Quatlro 330

900

Toshiba 6200

3200

. 12.8. Title ColumnHeader

QuickReport

369



. ,
, Font
( ): TQuickRep, TQRBand,
. ,
Font Title ColumnHeader .
Ti tl e 14
, ColumnHeader 12 ,
.
, , (. 12.9).

^^^

Quattno 330

900

Toshiba 6200

3200

Lucky Pro 450

2200

>aaei<8{)'

. 12.9.


PageHeader ( )
PageFooter ( ).
Bands TQuickRep
true Bands. HasPageHeader Bands. HasPageFooter.
,
.
: ,
. .
TQRSysData. ,
.
,
.
, . ,
, ,
. ,
TQRSysData, TQRLabel. -

370

12.

. 12.10,
. 12.11.

i l l Foiml
!

:--;=

;J9.02.00 17:19:11]

?.

|*

|'

iTii:.:

"=

s<)

^
.

'

-jjjil

. 12.10.
BBE3I

jPnnlPieview

i l l

< > # ff'jfrwl


19 02 0017 26 04

Quattro 330

900

Toshiba 6200

3200

Luck/

2200

Pro 450

Delphi 5

180
:ftft:^j-;#:ft>WSffl;ft!!^!^: : A!ft ! rW9!5 ! ft

"

' 4

. 12.11. -

,
Options.FirstPageHeader TQuickRep
false. , , .
.
Options.LastPageFooter TQuickRep false.


Summary.
.

QuickReport

371

.
.
:
1. .
Bands.HasSummary QuickRepl true.
2. Summary TQRLabel TQRExpr.
3. TQRLabel Caption
:, :.
4.' Expression TQRExpr.
COUNT, SUM(ADOTabl el. ).

-.
.

. 12.12,
. 12.13.

! 1 ;'-'-

-1

-J

*
L

$ ^

pOUNf

cmouMocmo.^UMfADOTablel.I/eHa)^

;.;

,,,

. 12.12.
hM;Plint Preview

\\ < * * &.

te<j

Satellite_450 R

2000

Microsoft Office 2000

300

Microsoft Office 2000

200

: 16

15675

:zl

, 11 ,

"' ' % ^
. 12.13.

372

12.


-
. ,
,
- ( ). QuickReport
,
.



, IndexName
(TADOTabl e ).
.
.
IndexFieldNames ,
. ,
.
.
,
:
1. IndexFieldName ADOTabi el
.

2. .
Preview Qui ckRepl ,
(. 12.14).

TADOTabl e,
Sort . ,
, ,
ASC DESC,
(ASCENDING) (DESCENDING).
, .

. ,

, Sort
:
Sort: = ' ASC. DESC;

Sort TADOTable ,

.

QuickReport

; 1 1 ' ; < :>&]

373

&**\

"** Builder 3 '

30

"Delphi 5 "

25

Borland * 5

250

Delphi 5

180

Fractal Design 5.5

395

Luck/ Pro 450

2200

Microsoft Office 2000

300

Lt

. 12.14.


, -
.
, ,
, . ,

.
TQRGroup.
TQRBand GroupHeader,
. TQRGroup
Expression, .
TQRGroup ,
GroupHeader, Detai 1.
. ,
, .
, .
1. TQRGroup Qui ckRepl.
GroupHeader .
.
2. ,
Expression GroupHeader ADOTablel..
,
.
3. GroupHeader TQRLabel TQRDBText.
-

374

12.

. Caption TQRLabel ,
DataField TQRDBText .
.
GroupHeader
. 12.15.

>'

:^3 02.00 18:12:45]

^
{

[ , ]

$ .^

.^ ^(11.)^

. 12.15.

4.
, .
IndexName ADOTablel .

Sort TADOTable.

. 12.16.
,
. GroupFooter
.
GroupFooter
.
:
1. TQRBand Qui ckRepl. GroupFooterl.
2. FooterBand GroupHeader FooterBandl.
GroupFooter.
3. GroupFooter TQRExpr. Expression
COUNT, SUMCADOTablel.).
ResetAfterPri nt TQRExpr true.

375

QuickReport

, Expression,
.
. 12.17.
:!; * jjg#iBt: i i fe.j

1
"Delphi 5 "

25

"C++Builder 3 '

30

Qualtro 330

900

Toshiba 6200

3200

Lucky Pro 450

2200

Satellite_330

1000

Satellite_330 R

1200

PageloH

. 12.16.
Plinl Preview

,- < * ; s # ; e < # ! so!



1
"Delphi 5 "

25

"C++Builder 3 '

30

55

2
Quattro 330

900

Toshiba 6200

3200

Lucky Pro 450

2200

Sate!lite_330

1000

I
J

Pge } <* Z

. 12.17. GroupFooter

376

12.


,
. QuickReport
.
,
, Frame .
.
Frame TQRFrame, , ,
7 . DrawBottom, DrawTop, DrawLeft DrawRight
Boolean : ,
, . , true,
.
(Color :
TColor), (Width : Integer) (Style : TPenStyle).
(. 12.18).
Object Inspectoi

zl

JDelailBandl TQRBand

Property* | Everts 1
)3Ftame

'

'

Cefoi
DfawBetan
DwwLeft
OwwRisW

WS*i

sAI! shown

(TQRFiame)

cBts*
Tiue
Tiue
7n*
False

'

*i

iimSud
1

zl

. 12.18. Frame

,
, TQRShape.
Shape qrsVertLine ( )
( Height) ,
TQRShape. (,
memo-), TQRShape
BeforePrint :
procedure TForml.DetailBandlBeforePrintCSender: TQRCustomBand;
var PrintBand: Boolean):
begin
QRShape2.Hei ght:=Detai1Bandl.Height:

end:
.
.
,
(, ,
), ,
. :

377

QuickReport

1. true Frame.DrawBottom, Frame.DrawTop, Frame.DrawLeft


Frame. DrawRi ght Col umnHeader.
2. true Frame. DrawBottom, Frame. DrawLeft "rame. DrawRi ght
Detail.

3. ColumnHeader Detail TQRShape


Shape qrsVertLi ne.
,
.
4. Height TQRShape ,
Height , .
Delphi ,
. 12.19.
. 12.20.

-u7:r:-ffit '

"

;:

>

iJ

1 ! * " I ill '

, ; :,jjj

. 12.19. Delphi



. , Detai I,
, .
- ,
.
. Detail.

QuickReport Labels, Forms .
.
sales.mdb,
, .
1. .
2. File New Delphi IDE.
Forms QuickReport Labels.

378

12.

, TQui ckRep (
QuickRepl), Detail, (
MasterTable).
3. MasterTabl e sales.mdb.
Iriip.l.xi
SI S

<

\& & ,te|

"3

;1(5

"Delphi 5 "

25

"** Builder 3 "

30

Qualtra 330

900

Toshiba 6200

3200

Lucky Pro 450

2200

SateWe_330

1000

. 12.20.

TADOTable.
,
TADOTable MasterTable.

4. Detai 1 Qui ckRepl TQRDBText


TQRExpr. MasterTable.
5. DataField TQRDBText , ,
, . Expressi on TQRExpr
: MasterTabl.+' '+MasterTabl . .
6. , . 12.21.

Si

Si; UHLabnlFoim

[]

!
]
MasterTable. +' '+MasterTable. ]

. 12.21. Delphi

QuickReport

379

7. ,
, BeforePrint Detail.
- PrintBand,
Bool ean. ,
. fal se,
. ,
,
:
procedure TQRLabelForm.DetailBandlBeforePnnt(Sender: TQRCustomBand; var PrintBand:
Boolean);
begin
Pri ntBand:=MasterTable['']='':
end;

- BeforePrint
. Delphi
, .

13


, .

.

. , ,
,
.
( ) .


, .
, ,

. ,
.
, .

( Delphi)
, :
.

381

, ,
,
(,
), .
, ,
.
, . Delphi
SQL-
, Delphi.
Decision Cube .

.
.
,

.

.

.


,
-
. , ,

.
.
SQL-,
.
.

.



- .
-
SQL-, TQuery.
TDBGrid (
, ).

Sales.mdb. -

382

13.

.
.
1. File New Application.
2. TADOQuery TDataSource,
.
3. TADOQuery
Sales.mdb: ,
ConnectionString,
.
4. SQL ADOQueryl :
SELECT , 01([ ]) AS [ ]
FROM
GROUP BY

5. DataSourcel: DataSet
ADOQueryl.
6. TDBGrid
DataSourcel.

7. OnShow OnCl ose .


OnShow , OnCl ose :
procedure TForml.FormShow(Sender: TObject):
begin
ADOQueryl.Open;
end:
procedure TForml.FormClose(Sender: TObject: var Action: TCloseAction):
begin
ADOQueryl.CI ose:
end;

8. .
, . 13.1.

1
1
20
6

. 1 3 . 1 .

383


,
.



. Delphi

Decision Cube.

Decision Cube
TDeci si onCube,

.
. ,
,
, . ,
, ,
, , -
(, . .) (. 13.2).

N
I-f
/~~~

./

,/

V*
7

2
1

...
. 13.2.


- ,
. ,
(. 13.1),
.
,
, ,
, .
-

384

13,

2-4 ( , 2,
. ,
).
1 3 . 1 .

12

15

14

...

...

, Decision Cube, :
.
, :
TDeci sionQuery , SQL- (
, );
TDeci sionCube ;
TDeci si onSource ,
.
,
, :
TDecisionGrid ,
, ;
TDeci s i onGraph ,
, ;
TDeci si onPi vol
.
TDBNavi gator,
.
Decision Cube Delphi
. (
TDeci si onSource)
SQL- (TDecisionQuery),
(TDecisionGrid TDeci si onGraph).

Decision Cube, :

385

=> => =>


=>
Decision Cube
, .
.
Decision Cube ,
.
, Decision Cube.

, .
.
sales.mdb.
.
.


File New Application
Decision Cube. :
TDecisionQuery;
TDecisionCube;
TdecisionSource;
TdecisionGrid.
Decision Cube .
TDecisionGrid .
.
.
.
,
. . 13.3.

TDecisionQuery
TDeci sionQuery TQuery.
, ,
TDeci sionQuery Delphi
. :
Q TDecisionQuery,
;
Decision Query Editor TDecus onQuery.
TDecisionQuery
: Dimensions/ Summaries SQL Query. (. 13.4)
,
. BDE
, . -

386

13.

BDE MS Access 2000


, .
MS Access 2000,
sales.mdb. Decision Query
Editor Database.

t::- cc:: :
&:*}

. 13.3. Decision Cube Delphi


Decision Query Emoi

Ijattsnporw;
" "
" "
" "

" "

" "
" "

J
^umraciiesSUMI )

" Court I") f Average


Database:

1
{

iSu*fet .

" 3

JMS Access 2000

OK

Quegj Fields

Cantri (

m>

. 13.4. TDecisionQuery

TDecisionQuery
BDE.
BDE BDE Administrator.
,
Decision Cube , ADO.

387


Table, ,
.
.
, , List of
Available Fields ,
. ,
, ,
.
,
List of Available Fields Dimensions.
List of Available Fields ,
. Dimensions
.
Dimen
sions , .

Dimensions .
,
.
Dimensions.

,
. ,
.
,
.
,
List of Available Fields Summaries.
,
List of Available Fields
, .
Summaries,
,
(. 13.5).
,
,
(sum).

Summaries

. .

388

13.

" "
" "
" "

"

" "
" "

gtmaittaiia*:
SUM( )

l a t e
|

2J

SOW*
t f f j f o i Averages
Oalabasg:
9
JMS Access 20UU" ' ' " "
Quero Fields

OK

SQtluMef ..

. 13.5.

!
QueQ? Teat
SELECT " ". " " 5 [ * J
I
PRDM
GROUP BY ." ". ." "

d
* Queiji

SatSuWef...

Cancel

>

. 13.6. SQL-

, Dimensions/Summaries,
SQL- .
SQL Query (. 13.6).
SQL-, SQL Query, .

.
,
TDecisionQuery.

TDecisionCube
TDecisionCube .
DataSet,

389

, TDeci slonCube .
DecisionQueryl ,
TDecisionQuery.

. -
TDecisionQuery,
(. 13.7),
, ( Decision Cube Editor
).

Settings 1 Control}

Avatafctefisids
*
"

Display !

-;

Actwa Type

]As Needed

Foifflat

I
(""-

OK

d
d
J

Caficst

. 13.7. Decision Cube

Decision Cube (. . 13.7) : Dimension


Settings Memory ControL ,

:
Display Name , ,
.
.
,
1002.
, :
. ,
TDecisionQuery, .
Active Type , ,
.
:
As Needed ;
Active ;

390

13.

Inactive .

As Needed.

Format ,
.
Grouping , ,
:
None ;
Year ;
Quarter ;
Month ;
Single Value .

Memory Control (. 13.8) Decision Cube


, ,
.
Decision Cube Editor

MemuiM"

&

gmmwes

Cutfsnfc

11

ftlive*Ns!Kteif

33

S(Cff Counts j

fiesijjiwt Del Gpfcrte


f

eisplayDiraansiw* taffies

|",5^

UK

Cercset

m>

. 1 3 . 8 . M e m o r y Control Decision Cube

:
Cube Maximums Designer Data Options.
Cube Maximums
, ,
.
,
. :
, ,
TDecisionCube
.

391

Designer Data Options ,


:
Q Display Dimension Names
. ;
Display Names and Values
, .
.
Display Names, Values, and Totals :
,
;
Run Time Display Only .

TDecisionSource
TDecisionSource
TDataSource.

.
Deci sionCube TDeci sionCube.
, , Decisi onCubel.

TDecisionGrid
TDeci si onGri d ,
, .
TDBGrid.
DecisionSource.
DecisionSourcel ( ,
) .
TDecisionGrid
( , ,
. .), .


TDecisionGrid ,
. ,
,
. OnShow
:
procedure TForml.FormShow(Sender: TObject):
begin
DecisionQueryl.Open;
end;


, .

392

13.

, , OnClose ,
TDeci sionGrid:
procedure TForml.FormClosetSender: TObject; var Action: TCloseAction);
begin
DecisionQueryl.Close:
end:

.
, . 13.9.

ILbisi*

'
1

482

^^
5

100

20

11
12

IS

'

20

22

. o*.t

5
20

S
!

15
1

50

20

23

0
10

33

24

10

15

71

0
10

10

0
508

70
33

15

40
0

12

65

10

49

1
10

10

92?.

20

. 13.9.




.
.
.
SQL-.



,

.
, . ,
:

;
;
.

393

, TDecisionQuery
MS Access 2000 ,
SQL-, ,
BDE,
MS Access
, .

Paradox. , , DataPump,
Delphi, Paradox
MS Access 2000.

,

TDecisionQuery.

,
Decision Cube BDE.

TDecisionQuery
. ,
, SQL-,
. SQL Query
Decision Query, SQL TDecisionQuery.
,
. SQL-
:
SELECT .. .,
.
FROM . .
WHERE (." " = ." ") AND
(." " = ." ")

,
, Decision Query
.
, Dimensions/Summaries
Decision Query (. 13.10). List of Available Fields
, .
,
. SQL-
.
.
, ,
.

394

13.

Dflnw^^S(#twfc3ti$$ I SQL Qufcty |

of Abatable Ffekfc

&ijntweWK

" "
" "
" "

" "



!
" "

* *)^*

i-abk

Sa|es

"3 !

Query Fields

Eared

SQU

. 13.10.
^

"C*+Mdei "OeloNSer Bodaftd C*+

Delphi 5

50

40

40

10

12

Fractal Deae Luck? Pie 4 Mieiosolt Offi Qualtto 330 6200


5
1
5

1
10

20

20

20
10

15

;
'

100

10

.*

St*'-.'

15

15

3
8

5
33

20

'&
m

402

10

10

-e'i-._

SS2
30

1|1|||| 111111l l l i l l i i l l l l l l l l l i l l i . l l l i l l i lip

T
?

. 13.11. ,

.
.
(. 13.11).

,
.
Decision Cube .


.
, :
;
;

395

.
:
,
SUM ;
,
COUNT .

TDecisionQuery , .

(. 13.12).

osra

asm

1201.2003

1? at

21.01.2000

2301.2000

27.01 2000

2801,2000

31.01.2000

;'Se!phi5BrTC

50

10

:81andC**5

' ' '$ '

10

10

10

10

10

I Dfch>5

-'

20

', ' 8
Jtudiji Pro 15

"" & *
^Microsoft

15

- ; -"Ss _

I Queue 330

!
1

10

;-, > ',

jrashbaSKfi

i
20

";

W$vj$wg& '

10

- , * *

15

ii>

IS

70

18

10

liLJ

18

10

"

""" """"

. 1 3 . 1 2 .

,
, , .
,
Grouping Decision Cube Editor.
,
.
Decision Cube Editor, Available Fields -

396

13.

Grouping Month (. 13.13).


,
, (. 13.14).
11
Dmensran Setting j ? Confiot j

**
DHpte&<!faros

*
"
SUM OF "
COUNT OF t "

~3
"3

Jj'pe

Grouping
Iniiial Value

Cmcd

. 13.13.

^^!

I |-|

X+*Butld3

"'

"Delphi 5

.2000

>,/

10

Ollioe

65

20

16

35

10

20
9
0

'

35
15

20
40
IS

&

23

1
20

2)
20

10

20

*t

.... ^0

S3

12

21

15

\ ,

20

>' -"'/
f'J ifwi'.'V^

67

35

^,";
Tosh&a 6200

$'
12

12

> ' $<*


Qua(tio330

12
10

^ " t ''

166

45

~> ~'

lucky Pto43Q

20

Facial Dessm 8

103

ja

'

Delphi 5

100
45

, & * *

10
0

60

10

Swt

' ; ,$

,2000

10

' Btan<JC+<-S

, 200

8
24

36

467

$?4

26

467

''

508

. 13.14.

397


BDE
BDE
, :
BDE. ,

BDE;
Q BDE, ,
: Paradox,
dBase, FoxPro, InterBase MS Access 97 ( ).
BDE ODBC,
. ,
, BDE+ODBC
MS Access 2000.

. Delphi 5
, BDE:
InterBase Express (IBX).
ADO.

InterBase.
SQL- InterBase
, BDE.
ADO .
ActiveX Data Object (ADO),
Microsoft. ADO
.
MS Access.
, Delphi,
TDataSet , , .
TDeci si onQuery,
Decision Cube, TDataSet.

.

ADO
ADO
Decision Cube. ,
.
SQL-, TDeci si onQuery
ADO TADOQuery.
: TDecisionCube, TDecisionSource TDecisionGrid.

398

13,

TADOQuery
:
TADOQuery TDeci sionCube.

TADOQuery
.
9
, .
SQL-,
. TdecisionQuery
TADOQuery ,
. SQL-
SQL.
:
SELECT .[ ], ..
., .).
. ])
FROM . ,
WHERE (.[ ]=.[ ]) and
(.[ ]=.[ ])
GROUP BY .[ ]. ..
.

TADOQuery MS Access

, . ADO
TWideStringField, TDateTimeField. TDecisionCube
TStringField TDateField.
SQL-
:
1. , TADOQuery,
.
2. Add all fields .
,
SQL- (. 13.15),
: ADOQueryl DSDesigner, ADOQueryl DSDesigner2, ADOQueryl DSDesigner3, ADOQueryl Exprl003 ADOQueryl004 (
13.1).
3. TWideStringField TStringField
( ADOQueryl DSDesigner2 ADOQueryl DSDesigner3),
TdateTimeField TDateField ( ADOQueryl DSDe
signer).
4. View as Text,
.
( 13.2)
, .

399

. 13.15. ADOQuery
1 3 . 1 . ,

TForml - class(TForm)
DecisionGridl: TDecisionGrid;
DecisionSourcel: TDecisionSource;
DecisionCubel: TDecisionCube:
ADOQuery1: TADOQuery;
ADOQuerylDSDesigner: TDateTlmeField;
ADOQuerylDSDesigner2: TWideStringField;
ADOQuerylDSDesigner3: TWIdeStringField;
ADOQuerylExprl003: TFloatField;
ADOQuery 104; TlntegerField;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject: var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;
13.2. ,

object ADOQuerylDSDesigner: TDateTimeField
FieldName = ' '
end
object AD0QuerylDSDesigner2: TWideStringField
FieldName = ''
Size = 150
end
object AD0QuerylDSDesigner3: TWideStringField
FieldName = ''
Size = 255
end
object ADOQuerylExprl003: TFloatField
FieldName = ''
end
object ADOQuery 104: TlntegerField
FieldName = 'Exprl004'
end

TADOQuery TDeci si onCube


.

400

13.

TDecisionCube
TDecisionCube Decision
Cube Editor :
(. 13.16).

D*mertArtS6<8sJMs Cannot |

"
"
1003"
xprl 004

OstfajllJiSi

gioupwg

Sum
Count
Average
Mm
Max
GenencAgg
Unknown

btSalVafse
jJs*Fsa

Canfifft

. 13.16.


, TDecisionQuery.
Dimension,
() Sum, (Exprl004) Count.
, , Display Name
(, ).
Grouping, , , Month.
OnShow OnCl ose.
ADOQueryl, .
.
, . 13.14.




, .


TDecisionGrid, TDecisionPivot.
:

/ ;
/ ;

401

/ ;
, .

.
TDeci s i onCube
Display Name.
.

TDecisionGrid
TDecisionGrid

, .
+ -,
. ,
-, (. . 13.14),

(. 13.17).
+, .

D
5

SH,

(.2{

Map, $00

S"D*(S>*5BI*3

|8ottaC**S

10

45

12

20

10

35

30

05

:ft*aaio<ss<$ri
jluekjs #>

23

it
m
5

12

;fusS20&

36

467

fiSJsEs

&
18

100

48

20

(&
:

.'

10

20

33
5

IK

to

. 13.17.


.
, . , . 13.18
, .

.
Options.cgPivotable TDecisionGrid false.


.
, , . 13.19.

402

13.

<,

**,2ffl&
I

&;*>

PSCiWB

11>
MSp,200D

,:;'^'\

10

^
"DeWSsno

60

8!?10*

10

10

45

OetpNB

20

20

10

10

35

11

20
1

20

100

10

Fiecld
> Pro 45
MiCWSoft IS

15

Suaiiio 330

10

20

'"

20
2

T o * i 8200,

21

15

12
J5

ES&

136

25

161

** |

1
8?

467
487-

JjJ

'

12
0

70

112

,...,. ,isj;

. 13.18.

* j *^>2

i j)plasiDaiandSi&totals
'!
D*spkj>DsH0>*

6?

,! *
!
I


i
*
| Quettre330

(?{(

12

574

182

52?

. 13.19. TDecisionGrid

.
/
.
. ,
.
.
.
, ( )
( ).
,
.
,
. Subtotals on/off,

, .
- (
, - ),

403

Drill in to this value. , ,


( ),
. ,
.
.

TDecisionPivot

TDeci si onPi vot.
DecisionSource .
.
TDecisionPivot :
Q ,
( , );
Q ,
;
,
.
: .
, .

.
, .



Delphi Quick Report,
. Quick Report
,
. Quick Report
( ), (
).
,

, :
;

.

, , .

. -

404

13,


QuSoft ( QuickReport) http://www.qusoft.
com/scripts/download.dll/getfile?Filename=CUBE_RPT.ZIP.
(
, ).



.
,
, .
Delphi ,
:
ActiveX ChartFX VtChart, ActiveX
.
, .
TeeChart:
TChart TeeChart.
, .
Additional .
TeeChart TChart;
TDBChart ,
, .
Data Control ;
TDecisionGraph
, ,
Decision Cube. Decision Cube
;
TQRChart .
QReport .



TeeChart:
TDBChart ;
TDecisionGraph
.
,
TChart.
, .
,
, .

405

TDBChart
TDBChart.
, . TDBChart,
,
, (
, TDataSet).
TChartSeries, ,
.
-
, .
SQL-.
TADOQuery.
, ,

.
.
1. : TADOQuery TDBChart.
Sales.mdb
(. 1-4 ).
2. TDBChart.
(. 13.20),
TDBChart, .
.
3. TChartSeri es. Add,
Chart/Series TeeChart.
(. 13.21), .
Pie.
Editing DBChaill
ChaH jSeries)
n ^ J l S ' i e ^ l A**

j TSes | Legend] Panel j Pasmsj Vafe ] 30

I Series

jA JJ
*~
f... k

. 13.20. TeeChart

406

13.

Standaid j j Elended j Sample! j


Lffie

OK

Bar

Cancel

Horiz Bar

P P

. 1 3 . 2 1 .

4. , , ,
. Series TeeChart,
Data Source ,
, Dataset (. 13.22).
811111
jSenesI

Data Souic* j
| Random Values

| No Data
Random Values
| Function
i'Sinqie Record

ttafc

Close

. 13.22.

(. 13.23),
:
Dataset;
,
, Labels;
,
, Pie.

407

Chert

&*ie* j

** Se

] Series!

Fatiest] aeneiafj Mks | |


Dalaset
fialaset;

jADOQueryl

labels. [

pie

jjj

] * j " Patelirfle

Cfese

. 13.23.

, TeeChart,
. ,
Chart/Titles (. 13.24)
(, . .).
.

t Chail j j Satias j
Sww j Sesffil| Anis

T&tes j U s e n d ! Panel j Pagng] WaJs ] 3D


Fg

goistef.

Aliment

* ? Center
BBciCoiw.,,

fettem

? * Frame

Dose

. 13.24.

5. OnShow OnClose.
ADOQueryl, .
6. .
. 13.25.

408

13.


2
1
1
20
6
| |

. 13.25.

.
. ,
(, () (Line Fast Line)),
, , .


().
, ,
,
.
TDBChart.
1. .
:
SELECT , C0UNTC[]) AS [ ]
FROM
GROUP BY

2. , ,
TeeChart TchartSeries.
(. . 13.21).
3. Sen es TeeChart
, .
Series/Data Source,
(. 13.26) ,
X,
, .
4.
, . 13.27.

409

Fewest j Seneiai i Mate

Data Souice |

JDalasel

J*)

Uelsset; JADOQueryl

d
! " tMetime

Bar

<r\ ~ OaleTme

Efose

. 13.26.

. 13.27.

TDecisionGraph
TDeci si onGraph ,
.
. TDBChart
TChartSeries
.
TDecisionGraph.
,
BDE.
:
1. TDeci si onGrid
TDecisionGraph.

410

13.

2. Deci si onSource
TDeci si onGraph TDeci si onSource (
DecisionSourcel).
3. .
(. 13.28).

"C++ Builder 3 " "Delphi 5 "


Fractal Design 5 5
S3 Lucky Pro 450
Toshiba 6200

Borland C++ 5
Microsoft Office Pro 97

Delphi 5
Quattro 330

. 13.28.

, Tdeci si onGraph,
. - TeeChart.

TDecisionGraph
. , ,
TDecisionPivot.



TQRChart, .
Title Summary,
.

411

-EST
1!1|||;111

l e i i H * ^ aw!
*(. (*'?

'~"

Page I of 1

. 13.29.

TQRChart TDBChart,
.
, TQRChat
- Tee Chart, .
. ,
.
. :
1. , File New
Report.
2. Summary TQRChart.
3. ,
, .
4. OnClick .
DBChartl QRChartl,
Previ ew Qui ckReport .
, , :
procedure TForml.ButtonlClick(Sender: TObject):
var i : integer:
begin
QuickReport2.QRChartl.Chart.AssigntForml.DBChartl):
// DBChartl QRChartl
for i:=0 to DBChartl.SeriesCount-1 do
QuickReport2.QRChartl.Chart.AddSeries(DBChartl.Series[i]):

412

13.

// Series DBChartl QRChartl


QuickReport2.Preview:
//
end;

5. .
. 13.27. , ,
, ,
, . 13.29.

,
TQRChart
TDBChart, ,
.

IV

14

.

.
DOS, , Windows,
.
DOS,
.
. Windows
,
.



, .
, ,
:

, ,
, ;

, ;

415

,
.

.
,
,
.
, ,
,
.
,
, .

.

. , ,
,
.
,

. , , ,
.
,
:

,
;
,
;
Q
.
,
(,
,
). ,
,
.

.
,
. ,

,
.

416

14,



. :
;
( Alt,
);
,
, , .
VCL Delphi TMai nMenu,
Standard .
TMai nMenu ,
. TMai nMenu
. 14.1.
1 4 . 1 . TMainMenu

AutoMerge

Boolean


SDI- (true) (false)
.
(TMenultem)
Grouplndex. MDI-

,

AutoHotkeys

TMenuAutoFlag

Images

TCustomlmageList

(
, ,
TlmageList). , ,
,

OwnerDraw

Boolean

, .
false,
. true

OnDrawltem.

, TMai nMenu, :
procedure Merge(Menu: TMainMenu)
SDI-. , ,
.
Grouplndex TMenultem;

procedure L)nmerge(Menu: TMainMenu) ,


.

417

AutoMerge true, Merge


Unmerge .

TMenuItem
TMenuItem.
TMenuItem , .
. TMenuItem
. 14.2.
1 4 . 2 . TMenuItem

Action

TBasicAction

Bitmap

TBitmap

Break

TMenuBreak :
(mbNone,
mbBreak,
mbBarBreak)


:
mbNone ;
mbBreak ,
;
mbBarBreak ,
,

Caption

String

Checked

Boolean

,
CheckBox ().
true, (
)

Default

Boolean

.
Default true,
.
, ,
true

Enabled

Boolean

, (true) (false).

Grouplndex

Byte

Imagelndex

Tlmagelndex

,
Images TMainMenu,
.
, Bitmap

Menulndex

Integer

Radiolteq

Boolean

,
TRadioButton.
Grouplndex

Shortcut

TShortCut

418

14.

TMenuItem ,
. :
procedure Add(Item: TMenuItem) ;
procedure Clear
;
procedure CIick OnCl ick ;
function (ACaption: string): TMenuItem ,
ACaption .
, ni 1;
function IndexOfdtem: TMenuItem): Integer
;
procedure Insertdndex: Integer; Item: TMenuItem)
Item, Index;
function InsertNewLineAfter(AItem: TMenuItem): Integer
;
function InsertNewLineBeforeCAItem: TMenuItem): Integer
;
function IsLine: Boolean ,
;
procedure Removedtem: TMenuItem) .
TMenuItem .
OnClick .
OnAdvancedDrawItem, OnDrawItem OnMeasureltem
, ,
. , OwnerDraw
TMainMenu true.


Delphi (. 14.1),
TMainMenu,
, Items
.


( )
:
( )
(
);
Caption .

419

. 1 4 . 1 .


Insert Ins.
( ) ,
Insert.
, Del,
Delete .
&
.
, , ,
.
.


.
, .

.


.
(. 14.2).

<

&>

AbS

. 14.2.

420

14,

Imagelndex,
Bitmap TMenuItem.
, Images TMai nMenu.
BMP- .
, ,
Imagelndex.

, , .


Shortcut TMenuItem.

, .
,
.
: Alt, Ctrl, Shift, BkSp, Ins, Del.
, ,
(. . 14.2).


, ,
(, ,
. 14.2, ).
,
. Caption -.


.
Insert From
Template , .
Insert Template (. 14.3),
. Delphi
, , ,
.
Save As
Template .


, :
;
;
Q Create SubMenu .

421

Insert Template
Edit Menu
Frfe Menu (for TextEdit Example]
Help Menu
Help Menu (Expanded)
MDI Flame Menu
Window Menu

. 14.3.

>,
.



.
:
Q OnCl ick ;
Action.

OnClick
OnClick
:
;
Q .
Delphi IDE
- OnCl ick:
procedure TForml.N4C1ick(Sender: TObject);
begin

end;

begin end -
. ,
:
procedure TForml.N4C1ick(Sender: TObject):
begin
if OpenDialogl.Execute
then begin
end;
end:

422

14,

Action
TActionList,
Standard .
,
. TActionList
: Name, Images Tag. Images
, .
(. 14.4),
TActionList,
.

. 14.4.

New Action
.
TAction,
TMenuItem: Caption, Checked, Enabled, Imagelndex Shortcut.
Category
.
, , -
OnExecute TAction.
Action ,
,
( , ,
). ,
OnExecute .

,
. ,
OnClick.
,
(,
), .
.


Delphi
. PopupMenu.

423


TPopupMenu.

, TPopupMenu
TMenuItem, .
,
OnCl ick,
, Action TPopupMenu.



, .
, .
, ,
VCL Delphi.
,
TTool Bar.

TToolBar
TTool Bar .
TTool Bar
, TEdi t, TComboBox . . TTool Bar
. 14.3.
1 4 . 3 . TToolBar

ButtonWidth

Integer

ButtonHeight

Integer

Images

TCustomlmageList

,
,

Disabledlmages

TCustomlmageList

Flat

Boolean

: (false) (true)

Hotlmages

TCustomlmageList

Indent

Integer

Ust

Boolean


: true,
, false

ShowCaptions

Boolean

, (true) (false)

#

424
1 4 . 3

14.
{)

Transparent

Boolean

: (true)
(false)

Wrapable

Boolean

true,

, TToolBar, ,
.

TTool Bar ,
,
: OnStartDrag, OnStartDock, OnEndDrag, OnEndDock, OnDragDrop,
OnDockDrop, OnDragOver OnDockOver.

TToolButton
, ,
TTool Button, . 14.4.
1 4 . 4 . TToolButton

Action

TBasicAction

Caption

TCaption

( ,
ShowCaptions TToolBar
true)

AllowAIIUp

Boolean

, (true) (false) ,
,

AutoSize

Boolean

true,
,

Down

Boolean

, (true) (false)

DropdownMenu TPopupMenu

Grouped

Boolean

Hint

String

Imagelndex

Tlmagelndex

Images ,

Indeterminate

Boolean

true,

Marked

Boolean

true,

425

Menulteq

TMenulteq

ShowHint

Boolean

true,
, false

Style

TToolButtonStyle =
(tbsButton,
tbsCheck,
tbsDropDown,
tbsSeparator,
tbsDivider);

:
tbsButton ;
tbsCheck (
CheckBox);
tbsDropDown ;
tbsSeparator, tbsDivider


, New Button
TTool Bar. , ,
ButtonWidth ButtonHeight TTool Bar.
, ,
New Separator .

.
, TTool Button, ,
:
function CheckMenuDropdown: Boolean ,
, true, DropDownMenu.
f al se, ;
procedure Click OnClick .
.
, TTool Button,
(OnClick), ( ,
TTool Bar).
,
TCheckBox TRadioButton.
Style tbsCheck.
: .
Down.
,
, Grouped , ,
true. Styl e
tbsCheck.
. AllowAllUp ,
, true, ,
.

. TTool Button,
. -

426

14.

, tbsSeparator tbsDivider (
).
tbsSepa rator tbsDi vider :
,
( . 14.5).
( . 14.5).

. 14.5.


:
OnCl ick;
Acti on;
, ,
Menu Item.
.
Menultem Menultem.
,
. ,
OnCl i ck.


,
.
Delphi, ,
: , . .
VCL Delphi ,
: TCoolBar TControlBar.
Microsoft comctl32.dll.
Inprise VCL.
.

TCoolBar
TCoolBar TCoolBand,
. ,

427

TCoolBar
TCool Band.
, TCoolBar,
,
, Bands.
TCool Bands Control TCool Band.
, TcoolBar,
. DockSi te TCool
true, DragMode
dmAutomatic.
, .
. 14.6 :
TCoolBar, .
i f
3*

'-

ill

. 14.6.

DockSite DragMode drag-anddock, . ,


,
, .
, .

TControlBar
TControl Bar
. (
) TControl Bar.
TCool Bar.
,
, .

15

, Delphi, (
).
,
.
, Delphi.
Delphi :
(-);
( DLL);
ActiveX;
VCL Delphi C++ Builder.

,
.
.


.

:
File New Application ;
File New Application
.

429

Delphi .

:
, ,
DPR, DFM PAS .
, :
D0F CFG ,
Project Options;
RES .



PAS, ( 15.1).
Object Pascal
:

Delphi, ,
. ,
, u s e s
, ;

TForml,
TForm. ,
;
Forml TForml.
,
;
{$R *.DFM}.

1 5 . 1 .
unit Unitl;
interface
uses
Windows. Messages, SysLltils. Classes, Graphics,
Controls. Forms. Dialogs:
type
TForml = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end:
var

430

15.

15.1 ()
Forml: TForml;
Implementation
{$R *.OFM}
end.

,
, ,
, , ,
. .


( 15.2).
,
.
,
Project View Source Delphi IDE.
15.2.
program Projectl;
uses
Forms,
Unitl in 'Unitl.pas' {Forml};
{$R *.RES}
begin
Application.Initialize:
Appl ication.CreateForm(TForml, Forml);
Application.Run:
end.

Object Pascal
:
: Forms Delphi, Unitl
, ;
{$R *.RES};
TAppl i cati on (
):
Initial ize ;
CreateForm (TForml, Forml) Forml;

Run .

431


(DFM) ,
. ,
New form as text Preferences
Environment Options.
View as Text
.

, View as Form
.

(. 15.1),
( TButton) ( TEdit),
15.3.
15.3.
object Forml: TForml
Left = 2 1 4
Top = 153
Width = 317
Height - 244
Caption = 'Forml'
Color - clBtnFaee
Font.Charset = DEFAULT_CHARSET
Font.Col or = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif
Font.Style = []
OldCreateOrder = False
PixelsPerlnch = 96
TextHeight = 13
object Buttonl: TButton
Left - 68
Top = 100
Width - 75
Height = 25
Caption = 'Buttonl'
TabOrder = 0
end
object Editl: TEdit
Left = 50
Top = 45
Width - 121
Height = 21
TabOrder = 1
Text = 'Editl'
end
end


, .

432

15.

:':'1::.'::|*'
Butlonl

. 15.1.


,
( ).
,
.


,
, .
,
.
,
, File New Form ( File New
Form ).
, .
,
.
,
. ,
. File New
Unit
.
( )
Project Add to Project.
,
, . ,

.
/ Project
Remove from Project. Remove from

433

TApplication

Project (. 15.2), ,
. , .

Ctrl.
Remove Fiom Protect
Unit

! Fltt

UniM

Foiml

UniO

Canwl

. 15.2. Remove From Project

(,
) File Use Unit .
Use Unit (. 15.3), ,
u s e s .
, , .


uses.
implementation, interface.

. 15.3. Use Unit

TApplication
, Delphi,
TApplication.
Windows. ,
Tappl i cati on, Appl i cati on.

434

15.

Forms
. TAppl ication . 15.1.
1 5 . 1 . TApplication

Active

Boolean

true,

CurrentHelpFile

string

HelpFile

string

ExeName

string

Handle

HWD

Icon

Tlcon

MainForq

TForq

Hint

string

TApplication ,
, .
. 15.2.
1 5 . 2 . TApplication

procedure BringToFront

procedure Minimize

procedure ProcessMessages


Windows

procedure Terminate

procedure Restore

TAppl i cati on .
TAppl i cati onEvents,
Additional .
, TApplication:
OnActionExecute ,
TActi onLi st;
OnActivate ;
OnDeacti vite ;
OnMessage ;
OnShortCut .



, . ,

435

, . ,
,
.

, , ,
, . ,
- .
.

Forms Project Options (. 15.4).
Protect Options

Oisetonwt/Coft&onals

)
]

...
sJAtem;

. ,. .

Coaipiet

Unkst

~-

JFoiml

$i*o-a**9 forms;

:
ii i

babble Joan*

'

Foim4

Form2

4
,

, ~~.

" Beta*

........

,,.

OK

Cttutt

. 15.4. Forms Project Options

:
Q : Auto-create forms Available forms. ,
. ,
, ;
:
> < ;
, ,
;
Main form,
.

.
Main form , Available forms,
Auto-create forms.

436

15,


.
Run Appl i cat ion CreateForm
. , ,
Available forms.

, , ,
CreateForm, .

Auto-create forms,
( Show ShowModal)
, Create .
, Rel ease.
, , Auto-create forms,
:
Form2:=TForm2.Create(Appli cati on);
Form2.ShowModal;
Form2.Release;


Delphi, 4,
. , ,
, ,
. , DLL
,
.


:
1. File New
Project Group.
,
(
).
2. , New
Add New Project
.
Add Existing Project .
.

View Project Manager
( ).

437

,
BPG , .

, ,
.
, .


.
,
. . 15.5
,
DLL.

|Pro|ect1 exe

New

<<*.

-,-.

, ~_~..~ . jpafh


: - Proiect1.exe

; - unin
$

UniH.pas

- Forml
- ) Unit2.pas
Praject2.dll
UniO.pas

D \WirApps\Borland\Delph5SPto|ecls
D: WirApps\Borland\D elphi5\Proiects
D:\WirApps\B orland\Delphi5\Proiects
0: \WirApps\Borland\D elphi5\Proiects
0: \WirApps\Borland\D elphi54Projects
DAWirApps\B orland\Delphi5\Proiects
D AWirApps\B orland\Delphi5\Projects
D:\WinApps\B orland\Delphi5\Projects

:;
. 15.5.

, ,
, , . DLL
, .
, ,
, .
,
, ,
.
, , .
Run Run.

:
Q Activate;
;
.

438

15.


Project Options,
Project Options. : Forms, Application,
Compiler, Linker, Directories/Conditionals, Version Info Packages.
, :

Forms ,
;

Directories/Conditionals
;

Version Info
;
Packages (.
8).

, ,
.

Application
Application (. 15.6) ,
:
Title ,
;
Help file (help) ;
Icon ;
Protect Options
Packages
fotms

Aepltealran

ABpfcatoastlinsts

Compile

'

Jptr )

* j

ad Icon... j

- Ou(pu< sstuns

Tsiselftlesiiterraort j

Default

SH

Cwct

. 15.6. Application Project Options

439

Load Icon
( );
Target file extension .
( DLL),
. , ActiveX
OCX.

Compiler
Compiler (. 15.7) ,
.
Pioiect Options
Oteatore^Cotiditmals
]
ftxms
]
Appfajtraft
Cede generate
p Opftrfeaton
P" Aligned ) feNfe
V Swd$ fraoia*
T P*nr%-sara fOff

Versanlnfo,
!
Coenpila
fkintimeeeers
,

P flense checking
P checking
P Overflow cneckiisigl

P feneeW<*{$
p DaSJnMstison&i
P" Assailant (1
fliseDebugK

P $

!
!

!
i

Message ' ' '


P

Wan*

>

Chugging
P Sebag H<srmafcon
P Local sjimbcfe

' $jmtax opter*


j ~ vafSiiiogij
* Complete boolean eva?
p E*fende4sFi(K
p QpsttEeraiwste
P Hugeilriigs
P Asstgnabfe Wed

Packages
jVfcat

OK

SJiOWjgarftfcgs

Cancel

. 15.7. Compiler Project Options

:
Q Optimization
, {$0};
Aligned record fields , {$}.

;
Pentium-save FDIV ,
, Pentium, {$U};
Range checking
, {$R};
I/O checking , {$1};
Q Overflow checking
, {$Q};

440

15.

Strict var-strings
, {$V}.
Open parameters.
Complete boolean eval ,
, {$};
Extended syntax (
). , , ,
{$};
Typed @ operator ,
@, {$};
Open parameters -
( , ,
,
), {$};
Huge strings ,
String. AnsiString, ShortString,
{$}.

.
$
( ), +
( ), -( ).
, IDE.

Linker
Linker (. 15.8) ,
:
Map file , ,
;
Linker output :
Delphi DCU C/C++
0BJ. C/C++;

Generate console application.


;

Include TD32 debug info


.
.
;

Include remote debug symbols ,


.

441


Pioiect Options

Fetsit

Application
'

"

|
--

a*gtnils

'

;
'

" C V * *

'"' " ' ' " " '

Memoiyajas
Mfesleotc fee ($00004000

" StwWsIB32<*sbugW<j
^

"

QeiwsieCsbfeclfites

EXE aid O l i otubnt


Geiwrate gemote appSeatam

Unk
' -'

*" Ssnerale ** abject files

U<E Desttfipjon.

Dsmptai

output

MarfsUxsksKe: j$00100000
_

J ^ J H W

]$00400000

Ott

Cenw*

. 15.8. Linker Project Options


Project
Run. , Delphi
, - Delphi IDE.
^
.


Project.
,
:
Compile (Ctrl+F9) ,
.
, ,
.
;

Build Compile ,
, ,
.
;

Syntax Check , ,
, ,
.
Compile Build. -

442

15,

.
;
Compile All Projects ,
, ,
. ,
;
Build All Projects ,
, , .


Run.
:
Run (F9) .
(
), ;
Step Over (F8) Trace Into (F7)
. Step Over ,
, ,
.

Trace Into;
Trace to Next Source Line (Shift+F7)
;
Run to Cursor (F4) ,
.

16

, ,
. ,
.
, ,

:
Q -, ,
,
;
Q -, .

, Windows-.

,
. ,
( ) ,

F1. ,
,

.
. -
, ,
, .

444

16.


, ,
- .
,
, ,
.


. ,
,
. , , ,
, - .

, . ,

:

, ,
;
- , F1.
-
;
;
,
.

,
. Delphi
.
(
) Delphi.
Delphi
,
.



Delphi. , ,

. -
.
Delphi, ,
. 16.1.

445

1 6 . 1 ,, ,

Hint

string

ShowHint

Boolean

, (true) (false)

ParentShowHint

Boolean

, (true) (false)

, Hi nt, ,
|. ,
:
|

. ( )
, , .
, Delphi:
function GetShortHint(const Hint: string): string
;
function GetLongHint(const Hint: string): string
, . ,
Hint.
Delphi , . 16.1.
, ,
, Application.
:
ShowHint: Boolean ,
. ,
,
false, , Hint
, ;
Q Hi ntCol or: TCol or , ;
HintHidePause: Integer ( ),
;
Hi ntPause: Integer ( )
(
).
OnShowHint Appl i cation.
- :
procedure (var HintStr: string: var CanShow: Boolean: var Hintlnfo: THintlnfo)
:
HintStr , -
;

446

16.

CanShow , , .
OnShowHint f a l s e ,
;

Hi ntlnfo , ,
, ,
. .

Application,
ApplicationEvents, Additional
Delphi IDE.


,
,
, .
VCL Delphi
, TStatusBar Win32
. TStatusBar,
SimplePanel, (SimplePanel = true)
(SimplePanel = false), - .
, SimplePanel true,
.
SimpleText TStatusBar. ,
,
SQL-, :
StatusBarl.SimpleText := '' +
IntToStr(Queryl.RecordCount) + ' ';


TStatusBar.
(. 16.1).

: 1 -TStalusPanel
I 2-TStalusPanel

. 1 6 . 1 . TStatusBar

:
Q TStatusBar, ,
Panels Editor ;

WinHelp 4

447

Panels
TStatusBar .
,
,
, .
TStatusPanel. ,
:

Bevel :
pbLowered ;
pbRaised ;
pbNone ;
Text , ;
Width ;
Style , :
psText ;
psOwnerDraw .
psOwnerDraw
,
. OnDrawPanel TStatusBar.
,
.


WinHelp 4
WinHelp ,
( hip).
Windows 3.0. Windows 95
, WinHelp 4,
winhelp.exe.
Microsoft WinHelp
( HtmLHeLp,
chm,
html). , , WinHelp
,
WinHelp.


WinHelp 4
WinHelp ,
. .

448

16.

(topic).
,
winhelp.exe. , ,
.
,
,
. ,
, , ,
, ,
.



.
.
.
. ,
.


,
, ,

.
WinHelp 4 cnt,
, .
,
Help Topics.
WinHelp 4 (. 16.2):
,
, . (heading)
(topic). .
.
, ,
.
, ;
,
.

;

449

WinHelp 4
Delphi -Bete;. . !
& * j ytsreflb j .!

0 ^^'**
( What's New in Delphi
Overview of new features

Database enhancements

Development Envifonment Enhancements

VCL enhancements

i?j

TeamSource

International tools

ActiveX

Upgrading lo Delphi 5

Quick Start Tutorial

^p

Programming with Delphi

Developing Database Applications

* Writing Distributed Applications

ZJ

^ b Creating Custom Components

.^pfeRV

..,

. 16.2. Delphi

WinHelp 4
. :
, ;
, , ,
, .
, ,
, ,
. , ,
Delphi , ;

(pop-up) ,
. -
.

WinHelp 4 255
,
. .
.
, ,
.



, ,
.

450

16.

WinHelp 4 30 .
. 16.2.
16.2. WinHelp 4

KLink

, .
,

ALink

, .
,

Find

Help Topics

ExecFile

ShellExecute

Shortcut

, ,
WM_COMMAND,

ControlPanel

MPrintID

BrowseButtons

CreateButton

InsertMenu

AppendMenu


,
.
Microsoft Help Workshop.
hip-, ,
Delphi , , ,
Delphi. Delphi/Help/Tools.
, Microsoft Help Workshop,
, RTF. ,
, MS Word,
.


RTF,
.
, .

451

WinHelp 4

,
. RTF- ,
, .
, .
, .
MS Word .
. ,
. (. 16.3),
. .
, .
B3SHHMBB ^.1?!*!
8>


^ 1 "**!

! , 3 , . .

!*
. .

<~

J ,,. ]

. 16.3.

,
. , ,
.
.


,
:
( #) ,
. .
,
;
( $) ;
( )
,
( Help Topics, ).
, .
, .

,
;

452

16.

( )
, ,
ALink;

( +)
,
. ,

RTF-;

, ( !), ,
;

( *)
;
( >) ,
.


.
MS Word ,
,
.

, Word,
.

,
. ,
(, )
. :
1. , .
2. MS Word .
.
3.
(. 16.4).


,
. ,

, .
:
Q
;

453

WinHelp 4

**

& !
'
"

' ^ ' ^ S^wje^J


" t ^

"
* $%&

|^6, J

I,,

?^*,,, 1

. 16.4.


, , ;
, ;
, .
,
, .
.
.
.
, :
1. , ,
.
2.
(. 16.5).
3. ( ) , ,
( #), .
4. .
.
5. .

Word.
, ,
MS Word.

454

16.

;
| Times New Roman

^ W t s i
J

StarBats
StarMath
Symbol
Tahoma

! ;

"

\3!

12 * |

!
AT

**
"
" ^^
" /

"

tSHye
" /

*
5
jfrofwe*t

. - -:""";.
^^

** tmttyltm, <8 )*1( . * IHW, * * * * at Hw*^>


**^^^ :

09

. 16.5.

KLink
ALi nk. .
,
: 1 ink , , a Al ink
, .
Kl ink, ALink :
!(< >.<>, >,- >)
:

< > .
, . ,
, ,
, ;
<>
. (
) (
, ):
JUMP (1) ,
;
TITLE (2) ,
, ,
,
, ;
TEST (4) , ,
;

WinHelp 4

455

< > , ,
;

> ,
. , ,
; , ,
.

.
,
, .
,
, .
, ,
, . ,
, :
1. , ,
.
.
2. , , ,
, ,
.
3. ( ) ,
.
4. ,
.
, ,
, . ,
, :
1.
.
2. ( ) ,
.
3. >, (
) , .
4. ( ) , >
,
.

,
, .
.

456

16.

,
.
:
{button <>. <>}
:

<> ;
<> , .
.

, bmp,
dib, wmf, shg, mrb.
:
{bmc < >} .
(, )
;

{bml < >} ,


;
{bmr < >} ,
.
,
MS Word. , RTF-,
, .


hip,
:
1. .
2. ( RTF- ,
. .).
3. .
Microsoft Help Workshop,
Delphi.

.


ASCII
.
. Help

457

WinHelp 4

Workshop ,
.
:
1. Microsoft Help Workshop.
...Delphi\Help\Tools : hcw.exe
hcrtf.exe ( , ).
2. File New Help Workshop,
New Help Project
.
3.
Project File Name.

, Microsoft Help Workshop (. 16.6).
1 ?S Microsoft Help Wofkshop -:[Tet (!^-|11 : , *:|1
j p He View Wmtow Jet Tools
,,

*|{<*|*|?|
Heap dff j T est proiect hip

$, i

I0PTI0NS1
LCID=0y419 0x0 0x0 .
REPORT=Yes

**

Wfedowt.. j

(5

6*1%,.

.,, j

gsvenftCopite j
Ready

:UT

. 16.6. Microsoft Help Workshop



. (),
, , . ,
,
.
, , Microsoft Help
Workshop . .

458

16.

Topic Files (. 16.7) Files


, .
Add
RTF- . ,
.
Remove. Include
, . Folders
,
.

Iepie fifes

::13

fold*..

Accept (41 m*ks in topic fet

. 16.7. Topic Files

Windows Properties (. 16.8)


Windows ,
.
Windows Properties ,
:
General (. . 16.8, ) :
Title bar text, ;
Auto-size height,
;
Keep Help window on top,
;
Position (. . 16.8, )
;
Buttons (. . 16.8, )
;
Color (. . 16.8, )
(Topic area),
(Nonscrolling area);

459

WinHelp 4

Window Pioperttes

Window Properties

STWMI } Fetation j Buttons) Cdot i |


JgWowtyptc

jeuuowj ** j Macro*]

-3

jwinl

- Window size and position

*1;

P" ^diuitfottisai'sst;t*!rt*idutit>n

gammer*

islt

(HI

Width:

Jl02

heiflf* JGOO

W W * * atorfcxites

J360

W Window (top

OK

Window Properties
Gencelj Fosirun Eulijfa j Color | M.-o-, }
Vff>Jow lyps

j1

Zetneia-1 PnatJun ( Pu"'"


i.11 idob"

j M&.fui ]

Bullor-t

P t-e)c toc<s
" Flint
F-d

" *'-

1, O f f i ;

Norsc'tArt:; siea cta


1

v* C i t o i

Ti p

ai*4 11I ii

"j
'

P Back

!\

:-=

. 16.8. Windows Properties

Macros ,
.
Bitmap Folders Bitmaps
, ,
bmc, bml bmr.
Map (. 16.9) Map.

, .
Topic ID Alias Alias
.
. , ,
( ) .

460

16.

Add...

Remove

Include

l&.

Cancel

Mtead of lt>H_- check these ptsl

I
j

OK

. 1 6 . 9 . Map

Configuration Macros, Config,


,
.
Options,
, Options. :
General (. 16.10, ) :
, (
Default topic);
( Help title);
, ,
WinHelp
( Display this text in the Version dialog box);
,
( If user paste or print Help text, display);
, ( ,
While compiling, display);
Compression (. 16.10, )
. (
Maximum),
. , - ;

Sorting
;
Files (. 16.10, ) :
hip- ( Help File);
log-, ;
RTF- ( Rich Text Format Files);

( Contents file);

461

WinHelp 4
ffflfipWi
FTS
general
fief**

Macros j
Cowtesto

toes.,

WstTesf
I
Sorfes

Ft*
Fjes

FTS
|
Genets!

M
i
Cemptetsirai

Tees
j Satins

None

^ feK*?J*ffHS^S?!

j
i

Fort
Bet

' P . . . - . ; - -
F Motes

P f t w

P>

]Si"|

- '-.-...

r -- ,. .->,
f ? . .', ,- , -

-i

Display It lejrtiniSaiiatwn dales fees:

I
If sets pes* a part tat <(Mes>'

FTS
Setwtst

j
j

*
j
CotafuMsfon

>
j
] Selling

Forts
Files

0T|vH9

i:wi*al

UH.iW*S,itJ>

FTS

I/H-3

CuWT^gs

Sort-

^-B-S
Itfl"

P ^e*ie"3le ! >B iM-t ir--

JjelpFfe j lest hip

f " jlir!lide *|.||,& *

.'rivifej/S

Rich Tes* Fowet pTFj ftes

""

i3

&&w~ )

* fr'nsfc* spft-nh-i v_4j4B |-wi 5:1


f~ i -1 ',< ghi aset

CofltetfoSejtestcnt

JMP fettel.

<* &'JKpLl/if * ^-J^ngple^w*

ia>s yi'i'fl JI'-HLV lc4Jf. , * / lunclK* *M

i*

-,- |

. 16.10. Options

( folder);
RTF- ,
( Substitute path prefix);
FTS (. 16.10, )
, .
;
Font ,
, WinHelp;

462

16.

Macros
;
Build Tags ,
*
.
,
, .
( cnt),
Microsoft Help Workshop.
:
1. File New Help Workshop
New Help Contents.
Help Workshop .
2. Add Above Add
Below. (
), .
Edit Contents Tab Entry (. 16.11).
lEdit Contents Tab Enfay
<* Uwdrig

<* Ifcpfc

nj

, . T*pie$0-.

-(

HW*

f %**

'1

W&mltf*. 3
|iXR

CenW

. 1 6 . 1 1 . Edit Contents Tab Entry

Edit Contents Tab Entry ,


:
Heading , Title.

;
Topic :
Title;
, ,
Topic ID;
, ,
Help file ( ,
);

463

WinHelp 4

, ,
Window type ( ,
, );
Macro .
Title, Macro;
Include .
Microsoft
Help Workshop (. 16.12).
. Microsoft Help Workshop - [teit.cnt]

frefoijt litenaoi jand widows


pesthip

S*.

~ |

^ J 1
'?' 1

Bamave

[7; 2
y j 2

<?;
?: 4
(?) 5
rfj 1
i i i iiiiii

muff

t<fau } J ^ f f * J ^^,,,
*

.4

. 16.12. Microsoft Help Workshop

Move Right Move Left


, .
,
Options, .



. hip.
Save and Compile,
Help Workshop,
File Compile .
Help Workshop
(. 16.13).

464

16.

/ Microsoft Help Workshop - (Compdatianl J


j te dl Jiew i^indaw Jest Tgols

ssisitti m\ %if|
Creating the help file testhlp.
Recessing <t;\wtnapps\boriand\o'efphi5\helpyool3\test.rtf
Resolving keywords.,.

5
1

Topics
Jumps
Keywords
Bitmap

Created (J^wtnappsV>ott3rtd\delphiS\heIp\tooIs\test.hlp, 10,592 bytes


Bitmaps: 1.ZD5 bytes
Compile time: 0 minutes, 0 seconds
0 notes, 0 warnings

Ready

SNUMi

S
A

. 1 6 . 1 3 . Help Workshop


, Help Workshop.



.
Microsoft
Help Workshop. File Run
WinHeLp . View Help File (. 16.14),

.
Open Help file as if it were
:

Invoked by a program ,
;

A pop-up ;

A double-clicked file icon ,


.
Mapped Topic IDs ,
.
- .

465

HTML Help
View Help File
te;

]d\winapps\borland\delphi5\help\to ]

Brp>9S&T, !

'TgpustOs
j d Wiapps\borlandSdelphi5\help\toolsjJ

j Choose an ID from this list

ftjteih

"*}

Ow Helpfile if i w e
**

foyfketmnptegiast

doubte^fckadjtte tam

VfewHeb

. 16.14.

Mapped Topic IDs ,


Map.

View Help File View


Help WinHelp.


HTML Help

Web.
Web. ,
,
HTML.
, Internet
Explorer, Microsoft HTML Help.
HTML Help Microsoft.
HTML Help
Internet Explorer, Microsoft
.
HTML Help, ,
WinHelp, :
Q (HTML)
;
Q HTML Help
.

466

16.

HTML Help :
:
Internet Explorer 3.02;
( );
DCOM95 1.2;
HTML Help
.
;
Q HTML Help .
.
Windows 98.

Windows 95. ,
WinHelp ,
Windows 95 ( Windows 3.x). ,
, HTML Help
32- Windows.
Linux
.
HTML
Help. , Delphi
. , , Delphi,
, HTML Help. ,
HTML Help ( ),
.

HTML Help
, HTML
- .
:
HTML- ,
.
. ,
;
HTML- ,
, ;
;
.
Microsoft
HTML :
(chm),
HTML- ;

HTML Help

467

: ,
;
, WinHelp
;
- API
.
HTML Help WinHelp.

HTML
.

HTML Help Workshop Microsoft.
Microsoft http://www.msdn.microsoft.com/library/tools/
htmlhelp/wkshp/htmlhelp.exe. 3,5 .
Microsoft HTML Help Workshop
hip-, ,
:
1. .
2. ,
.
3. .
.


:
html- ;
;
, ,
, (Contents);
,
.


,
HTML (, Microsoft Word).
HTML.

, , .
, HTML Help Internet Explorer:

.

468

16.


,
.
(ASCII) , ,
. ,
.
:
1. HTML Help Workshop
, File New.
2. New (. 16.15) Project
. New Project.
.

HTML File
T a b l e d Contents
Index

(..?*. ..)

Cal J

. 16.15. New

3. New Project Destination


,
. .
4. New Project Existing Files (. 16.16, )
, .
, 1 ,
HTML-,
HTML files (.htm) .
5. New Project HTML Files (. 16.16, ),
Add Remove, HTML- . ,
, New Project Finish
.
HTML Help Workshop
(. 16.17). .
HTML Help Workshop (. . 16.17) :
Project, Contents Index.
. ,
.

HTML-
. -

469

HTML Help

, . ,
HTML.

> I

. 16.16.

HTML Help Workshop


web- (. 16.18).
[FILES] Display in Browser.
Options (. 16.19),
[Options]
Change Project Options ,
HTML Help Workshop.
Options : General, Files, Compiler Merge Files:
General :
Title ;

470

16.

' ? HTML Help Woikshup - (.

jJaLsi

*;

~~1:
ill

[OPTIONSI
Compatibility=1.1 or later
Compiled file=test.chm
Default topic.delprv\Help\HtmlHelp\Miciosor"t H<
Display compile progress=No
Language=0x41

<html xmlns o"utn schemas-microsoft-com office office"


xmlns"w"urn schemas-microsoft-com office word"
xmlns-"http /Awww3 org/TR/REC-htmMO">
<head>
<meta http-equivContent-Type content-'text/html; charsetwindows1251">
<meta name-Progld content-Word.Document)
<meta name-Generator content-'Microsoft Word 9">
<meta nameOriginator content-'Microsoft Word 9">
<hnk rel-File-List href""./BBefleHMe.filesAilelist.xml">
<1></1>
<i-[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>pvn</o:Author>
<o:LastAuthor>pvn</o:LastAuthor>
<o:Revision>l </o:Revision>
<o:TotalTime>l </o:TotalTime>
<o:Created>2000-09-06T09:35:002</o:Created>
<o:LastSaved>2000-09-06T09:36:00Z</otestSaved>
<o:Pages>1 </o:Pages>
<:></:>
<o Lines>Wo Lines>
<n </ >

DtWaw ioKjjMBHrtAas* M><>

. 16.17. HTML Help Workshop


tf? HTML Help

raw*

iwpjfesensM

Microsoft Windows,
Windows Help ( WmHelp).

WinHelp , ,
.
, Microsoft Windows 95, -,
.
Microsoft , WinHelp .
, "The Internet Tidal Wave" ("
") fvsw-v.usdo.igov/atr/cases/exhibits/20pdf).
. Microsoft

Internet Explorer. , (HTML),
,
.
Microsoft HTML Help.
Microsoft HTML Help ( Windows 98, Office 2000,
MSDN Windows 2000). Windows,
, ,
. HTML Help
^jj
. 16.18.

Default file Default window ,


;
Language Font ,
;

471

HTML Help

StowalJFite* | Cecwtot j MwgeFle* |

lite

jBefal* tfa

jdelphi\Help\HtmlHelp\MK;rasoft Help

J^j

DefiiAjSinitoe*

.ij

frtte(natfoM) saaig$

: ffenb

,I

"

clwrg6

7,-, 1 I

. 16.19. Options

Files
(Compiled file), (Index file) (Contents file);
Compiler ;
Q Merge Files ,
.
WinHelp, HTML Help
, .

Window Types, Add/Modify window defini
tions Project.
, ,
, :

General ,
;
Buttons ,
;
Positions
;
Files , ,
, , ,
. .;
Navigation Panel .
, ,
. .;

472

16,

Styles Extended Styles


.


, . HTML
Help Workshop :
(Alias),
. ( HTML Help
WinHelp.)
HtmlHelp API information,
.
:
1. HtmlHelp API information.
2. Alias (. 16.20) Add.
3. Use it to refer to this HTML file
Alias (. 16.21)
, .
HtmlHelp API inhumation :
Map

Atas

j t t B ( . j

Mas itogs to HTML fifes


iO_lntroduc)ion=delph)\Help^Hlm(Help1\Miciosoft

<*,

include...

Whenever Constant orttutoharnflossedl&


* e <(* API,

Jisetto rsteiatfeis HTMt


jdelphi\Help\HtmlHelp\Microsoll Help'Works ~j
orrirrant

OK

. 16.20. Alias
HtmlHelp API information

Cawjel

. 1 6 . 2 1 .

4. 3
.
5. .
, HTML
Help Workshop [Al ias].



define- .

HTML Help

473

, #define,
:
#define Alias 5

.
, .
h.
.
HtmLHeLp API information Map
. HTML Help
Workshop [Map].

,

HTML Help, WinHelp,
. WinHelp
.

: .
.
: ,
.topic,
. , .
.topic 1
N 1
.topic 2
2

, ,
txt.
, ,
. .

HtmlHelp API Information, Text Pop-ups:
Text file,
Header file.


,
.
. HTML Help
Workshop :
1. Contents. ,
, Table of Contents
Not Specified (. 16.22).

474

16.
Table ol Contents Hat Specifieds
Ywhave netiKrtsoeiaid stable tt interns (,M) lie
withes ftrgjed V0y pen $ithe* eatra ftewtraits*We/,
ot seaify a wfefins He.

QptsnnsierXKinte<*sSe
OK

Cawef

. 16.22. Table of Contents Not Specified

2. ,
Create a new contents file
. .
3.
. ,
.
4.
: Insert a heading Insert a page.
, .
Table of Contents Entry (. 16.23).
1T ol Contents E ntij

iiiiSiS

dd,.

*...

fltmova

;lesAIRU rid the irfcifriata types:

MeftwieUfH-

'

Add**... j

L-2LJ.

. 16.23. Table of Contents Entry

5. Table of Contents Entry


Entry title html
. . Contents
.
6.
.
.

HTML Help

475


HTML Help
:
;
.
,
.
.
, ,
, ,
. :
1. Index.
Index Not Specified, Table of Contents Not
Specified (. . 16.22).
2. Create a new index file
. ,
. ,

, .

. Index,
, .
3. Insert a keyword,
Index Entry (. 16.24).

Sweat J M w i o c d l
' intofmaticntp,*

delphiSHelpVHImUdfAMicrosoll Help Woi


HTML help
delphi\Help\HlmlHelp\Miaosoft Help Wot

^MsmsteURL*

hj

...
OK

. 16.24. Index Entry

476

16.

4. Keyword , , Add,
Files/URLs and their information types ,
.
5. Edit,
Remove.


Options, Compiler Compile full-text search
information.
-.



.
, Project
Save project, contents and index files .
Compile HTML file
HTML Help Workshop.
HTML Help Workshop.
, View com
piled file. ,
. 16.25.

] | [
-1 '_^
J ]
js] HTML Help
+
i C j
+} LU

&

flapflgjarpbl

Web
,
,
. Microsoft
Windows,
Windows Help ( WinHelp).
WinHelp ,
, .

, Microsoft Windows 95, , .
Microsoft
, WinHelp .
, "The Internet Tidal
Wave" (" ")
1?5$1^11551)&!!&120.,&).
.

. 16.25. HTML Help

477



,
WinHelp, HTML.

.

.
.


WinHelp
Delphi TApplication ,
WinHelp.
WinHelp
Appl i cation
.
:
1. , .
hip- HelpFi 1 Appl i cati on.
Options,
Project Options Delphi IDE.
Application (. 16.26) Help file.
(
Project View Source) :
Application.HelpFile := 'TEST.HLP':

,
.

.
,
! pFi I e ( TForm).
. ,
. HelpFi 1
, Appl i cati on.
2.
. HelpContext,
Delphi,
.
,
.

478

16.

Pioiecl Options
pBftttff-eSjCwilJiir-f.a t

i
- J

* e sen Into
J
Compter

I*re j
neplile j"E?"t-_"

svl
w=- 1

Culpa1 settings
T ngr! f

fidcic*

f.risjli

. 16.26.


- . F1
WinHelp, ,
HelpContext , .


. ,
WinHelp,
.
Appl ication,
. TApplication ,
:
function HelpCommand (Command: Word: Data: Longint) : Boolean
WinHelp API (application programming interface),
Command, Data;
Q function HelpContext (Context: THelpContext) : Boolean
WinHelp, ,
Context;
function He! pJump (const JumpID: s t r i n g ) : Bool ean
, , .
HelpCommand,
API WinHelp. 20,
:
HELP_C0MMAND WinHelp. Data ,
. ,
.

479

HELP_CONTENTS .
Data 0.
HELP_C0NTEXT WinHelp ,
Data.

HELP_C0NTEXTP0PUP , Data,
.
HELP_I NDEX .
Data 0.

OnHel p Appl i cati on. -
:
function (Command: Word; Data: Longint; var CallHelp: Boolean): Boolean
Command API WinHelp; Data ; Cal 1 Hel p
, , .
OnHel p
. ,
. F1
WinHelp API HELP_C0NTEXT, .
OnHel p.
, ,
1 10, :
function TForml.ApplicationEventslHelp(Command: Word: Data: Integer; var CallHelp:
Boolean): Boolean;
const
F : boolean = true;
begin
case Data of
1..10 :
i f F then begin
F:=false;
CallHelp:=false;
Appl i cati on.Hel pCommand(HELP_C0NTEXTP0PUP.Data);
end
else F:=true;
end:
result:=true:
end:


F. OnHel p ,
(Stack Overflow):
case Data of
1. .10 :
begin
CallHelp:=false;
Appli cati on.HelpCommand(HELP_C0NTEXTP0PUP.Data);
end
end;

480

16.

, ! pCommand OnHel ,
.
- ,
( F1)
OnHel p :
OnHel p F1.
, then i f:
!pCommand, F
false;
OnHel p
OnHel p Hel pCommand. -
fal se, el se
i f: F true,
.

Delphi
HTML Help
Delphi
HTML Help.
API HTML Help.
htmlhelp.h htmlhetp.iib, HTML Help
Workshop.
C/C++. API
HTML Help, Object
Pascal. ,
. , Delphi API HTML
Help,
ftp://deLphi-jedi.org/api/HtmlHelp.zip.
HtmlHlp.pas, , ,
HTML Help.

HtmlHelp
chm-
:
function HtmlHelp(hwndCaller: HWND: pszFile: PAnsiChar;
uCommand: UINT; dwData: DWORD): HWND; s t d c a l l :

:
hwndCa ,
chm-;
pszFi 1 chm-, chm-,
uCommand;
uCommand HTML Help;
dwData .

481

hwndCaller ,
0.
(desktop) Windows.
pszFile, ,
:
chm- [: .7\.:] ^ ]
,
[FILES] .

HtmlHelp
-
Html He! p .
HTML Help , :
HH_DISPLAY_T0C ,
, .
dwData .
^
HtmlHelpCO. P C h a r ( ' H e l p F i l e . c h m ' ) . HH_DISPLAY_T0C. 0 ) ;
HtmlHelp(0, PChar('HelpFi1e.chm::/<>\01.htm ' ) .
HH_DISPLAY "TOPIC, 0 ) ;
HtmlHelpCO. P C h a r ( ' H e l p F i l e . c h m ' ) . HH_DISPtAY_TOPIC.
DMRDC PCharC'<>\01.'))):

,
.
, topic.htm.
: pszFile,
dwData , ;

HH_DISPLAY_INDEX .
dwData ,
, .
, . HtmlHelp
HH_DISPLAY_INDEX :
HtmlHelpCO. PCharC'HelpFile.chm'), HH_DISPLAY_INDEX,
DWORDCPCharC'< >')));

HH_HELP_CONTEXT ,
, dwData. HtmlHelp
:
HtmlHelpCO. PCharCHelpFile.chm'). HH_HELP_CONTEXT.
<Topic ID>);

HH_DISPLAY_TOPIC ,
: pszFi 1 ,
dwData , .
Html Hel p :
HtmlHelpCO. PCharC'!pFi1.chm>Mai'), HH_DISPLAY_TOPIC.
DWORDCPCharC'<>\1.htm'))):

482

16,

HtmlHel(, PCharC'HelpFile.chm::/<nyTb>\Topic.htm'),
HH_DISPI_AY_TOPIC, 0):

Q HH_TP_HELP_WM_HELP .
,
Pop-Up (. ). Html Help
:
Html Hel (< ;,
PCharC'HelpFile.chm::/PopUp.txt'),
HH_TP_HELP_WM_HELP. DWORD ((aids)):


, .
dwData ,
:

DWORD;
;
0;

Pop-Up-.
, ,
Editl 100:
lds[0] = Editl.Handle:
Ids[l] = 100:
Ids[2] = 0:
Ids[3] = 0
HtmlHelptEditl.Handle, PChar('test.chm::/PopUp.txt').
HH_TP_HELP_WM_HELP. DW0RD(@Ids)):

HTML-
, ,
chm- .
, Delphi.

WinHelp
Html Help .
OnHel p
Application.

ApplicationEvens, Additional .

chm- :
1. A p p l i c a t i o n . OnHelp .

483

hip-, .
WinHelp , OnHel p
.
2. HelpContext
.
3. - OnHel p :
function TForml.Appl1cationEventslHelpCCommand: Word;
Data: Integer: var CallHelp; Boolean): Boolean;
begin
// WinHelp
CallHelp := False:
// , ,
//
HtmlHel(0, PChar(ApplIcatlon.HelpFi 1 e).
HH_HELP_CONTEXT. Screen.ActiveControl.HelpContext);
Result := True:
end;

,
.
, OnHel p .
,
, Html Hel .

17


.

- .
(RAD,
Rapid Application Development) . RAD
,
.
. ,
,
, .
.
,
, ,
.



,
.
.
:
, ;
.

, ( , -

485

DLL, ActiveX, ),
.

(PVCS, Project Version Control Systems).
,

(), .
, :

, ;
;
.

, .
PVCS .
,
.
, PVCS

. ,
.



, PVCS,
,
. PVCS
.

.

. , ,
, .
- (,
, ).
,
.
.


. .

486

17.

1. .


( ) .
( )

, .
2.
.
,
.
,
, .

PVCS
, PVCS.
, PVCS.
1. .
PVCS.
2. ,
, ,
( , , . .)
, .
3.

.
4. PVCS ( )
,
.
5.
, .

TeamSource
Delphi ,
TeamSource. Borland
TeamSource ,
. TeamSource
Merant PVCS ( InterSolv)
. , TeamSource Borland ZLib,
zip- . TeamSource
,
TeamSource Extension API.

TeamSource

487

TeamSource ,
.
TeamSource , .
TeamSource
. ,
Merant PVCS .

, ,
. TeamSource
, .

TeamSource
TeamSource
(plug-ins), TeamSource Extension API.

,
,
, , .
,
tsx.
:

izlib.tsx ,
ZLib ( zip, ,
, );
tscomments.tsx .


TeamSource
TeamSource.
.

, ,
( , )
1.0. 99,
, .

,
TeamSource.

.
(Bookmark).
.

488

17.


, .
.

TeamSource
, TeamSource
. , (root),
,
, .
:
Archives , .
, ZLib. ]'
.
: ( )
.z (, project.dpr project.dpr.z).
:
( , TeamSource
,
);
, ;
History ,
. < >.<
>. ,
, , ;
Locks , .
Lockinfo.dat;
logs.txt ;
summary.txt .

TeamSource
TeamSource Delphi 5.
-, Delphi. TeamSource
Delphi.
TeamSource - - (. 17.1).

TeamSource
TeamSource Welcome to
TeamSource (. 17.2), ,
:
(user name)
Welcome to TeamSource ,
TeamSource;

TeamSource

489

. 1 7 . 1 . - - Delphi 5
[Welcome to T e i m S ^ ^ | | | w | | | l l | l &?
This, pas alsws ute tpeeSjt yoi fssisGnatinrorniafiafi Enter ( (gj
nam*, and an emaiE address* # you'd ike to (he emaiMaztfures of
TaamSoufte.

Yoyt set nam?;

jtwn

jViadinm Pelrov

Yout 0>sJ address.

Jpvn@dornain ru

Cartel

Previous j

Phish

. 17.2. Welcome to TeamSource

(full name) ,
TeamSource;
(e-mail) .
Welcome to TeamSource (
), , ,
TeamSource.

TeamSource
Welcome to TeamSource
TeamSource (. 17.3).
Microsoft Outlook.
TeamSource . :
File : New
Project; Open Project;
Close Project Exit;

490

17.

Project ,
TeamSource. ,
.
;

View .
, .
,
Views, TeamSource;

Options Preferences,
TeamSource;

Help .
Boiland TeamSouice <no project
fjte

eject M** 2 t * *

13
''*'

" ' ' * ':'/<'& '&^2^*&&&Z&f

'AJ:-':'fr

--,1
**&!'-!;-i*t~t-2uA.s

Getting Started
You can create a TeamSource proiect in one of two ways
.

Select FilelNew Proiect to create a new protect from


scratch defining the proiect s location contents etc

Select FilelOpen Proiect to search for an existing


protect which can then be accessed on your system

km
Usemame

LockTm*

, # Time

- Comment

. 17.3. TeamSource

, ,
Options Preferences.
Preferences, (. 17.4).
General (. . 17.4, )
TeamSource: (
), ,
( File Handling):

Update local file on each checkin (get after put)


.
, -

491

TeamSource

( CheckIn), , Check-In, . .;
Ignore spaces in files during compares
.
;
Automatically import comments during reconcile
Recommended changes Check-In.

Mnt Infamnrtton
jVladirrw Petrov

|!<*: ]pvn@>donwmi

! " ypdsJeiiaffteonea<!hheckinftjee<pi4
i * |jiwspace&flM during tMpasss
; S? A^iiw<teeHs!iffi|^wis**TO'ecfcite

H*

OK

ffiSEMBI

"x|

GansiaJ [ F f c V i S i |
.i se jnietna! viewaffof-

Usextemal viewer for


bmp
doc
htm
html
IPS
rtf

cpp
dim
hpp
pas
fc
Ixl

j j

bin (he of Hesitewtons f eacrnypeof view External W H S


^ drfiwdfeyft* intheWduftegtsty, Youmay
enter t&Aipfe extenabrt&oer ttnejsepsra'ed ^ sernicpipra OF cemmssj

0K

Cancer

w<*

. 17.4. Preferences

File Viewers Preferences


(. . 17.4, ).
, cpp, dfm, hpp, pas, re txt Use Internal viewers for.
,
TeamSource. Use External viewers for ,
,
.

492

17.

,
TeamSource
ASCII.


File New Project.
New Project (. 17.5),
: ( )
. ,
Create new project from scratch.

Select w h j * type of new project se create:


(? I^edle new project from sciaich^
Alow* stepiy-step eteatbi of a project
through an expert
C' Import an exerting project
Select an existing project tor I M I time
t#*> on system.

Heip

. 17.5. New Project

New Project
. .
1. (. 17.6) :
( TeamSource);
( );
( ,
, TeamSource).
Cieate New Protect - *tep J 7
Speetfy ptejetf ** I be fawawe E the project fie wll be
automabpflJIy appendftd^ and setecl the vers* &* use I storing

First Pioiect

JFustPioiect cpi
jjfef * controfer t at ptoject tfes:

BorlandZLib

Next

. 17.6. TeamSource

TeamSource

493

2. (. 17.7) ,
.
Create New - tleo 2 of 7
Enter the path to the base directory in wfach you would ike tenloreyout project

ftes. ehivfts, htsioty Bas, etc. dtaciov h only used as a default <ot a
options on the faScuwng pages
Base project dEradoiy
p

\Fsl Protect

Help

. 17.7. TeamSource

,
.

3. (. 17.8) (Archives),
(History) (Locks).
(
).
, .
Create New - ttep 3 of 7
Specify the project aichwe drtec lory, and the diiec lories for fhe history tehee kin

lops) and lock tfos


^fchives
p \First PioieclWchives

Hist)'ffledifecto<s<
jD \Fnst PioiectSHrctoiji

keek Be tfttctoiy:
JD SFirst Pro|ect\Locks

Cancei

Previous

H*

. 17.8. TeamSource

4. () (. 17.9)
.

494

17.
Cieate New Protect - step 4 <rfw*
$ like TeawSoim matttain esetef "itiam" freadabtejsouices.
*whsch lipreseflt the cUtient state ol the project, the option and
speeijifhetesationof t+is Minor tie.

|5
MSfetdwctorjiJiee stts as.
17 )',..

<4Plevm

Na*i>"s

. 17.9. TeamSource
Create New Protect - tee 5 of 71
ipeafy the publshinji optionsfatchanestto the pfojeel
ThMes> Summary ami ios I t e are cumulative text lite wHch <# contain
ooptes of (he cheek in aj(nmas and loss. letORStM?. leave these lietd*
biank if you do not wel* to use ths faatwe,
Master Summery file

|D \First ProiectVsummaty txt

Master l o g ftte

jD \First ProiectMogs txt

Sib, specify the SMTP stiver used fot deiveimg mail. Ifjiou do not with to
spaaf? mat paWssNno options t this trme, lews tha fW Wsnfc.

SMJP $*>;
Cored

j
Previous

Neitf

Hefp

. 17.10. TeamSource

Enable Mirror tree,


(mirror) .
. Mark Mirror files as Read
only , ,
read-only ( ).
5. (. 17.10) (
) . , SMTP-,
.
6. SMTP-, Next
:
(. 17.11). ( SMTP ) .
, , ,
.
7. (. 17.12),
, .
( Previous) .

495

TeamSource
ICieale New Project - ep 6 7 ^::::>1
stow* yeufc *(> the mats

to 1% of specfe QwcMn

ftAM>|ufittrii<M*

zl

i
i

f^abfeh t o s s e s lo-

Pu!>lt*teCh5e**ta

CaftMsS

Ptevtas

Nai

. 1 7 . 1 1 . TeamSource
1 Cieale New Pioiect tfep 7 of 7 4 ; ; 1 1!;-! "
Arifji trtfattetfpit
Project name;
FhtPtDJect

FMPwjMtqji.
AtcHves<Jit*te>F
Hieoty cfceoiov-

^
C.*wet

Pisvuw

i "" 1

. 17.12. TeamSource
Local Directory W i z a t d
fJelOw is the yggested bee stemptwe, f w e d on the ewsfanQ &*. Sefetst and
dries any w a n t e d tSwclajes, a w l the file mask w g g r i t i M a* needed

L J (root)
Q j comiled

ti|

cfg," dim," dol," dpi." pas," les

"

Oft

Cancel

. 17.13. Local Directory Wizard

Finish TeamSource
, .
Content Wizard (. 17.13).

496

17.

Local Directory Wizard ,


.
, .

Content Wizard
Project Content Wizard.
.
, .


Project Options,
Project Options.
TeamSource.
Project Options ,
Read Only .
. ,
, , TeamSource.
Project Options
.
Project Options . ,
.
General (. 17.14) :

Project Name .
;
Version info file name ,
.

( Pull);

Detect new local directories TeamSource


,
, Content
Wizard;

Require summary comments TeamSource



( Check-In);

Require file comments , TeamSource


Check-In
;

Build numbers
.

497

TeamSource

111|1| :1'>

^^^
|1|

11.0.0.0

Caricef::

5|

. 17.14. General

!1}"^'1^111
!^8^^^^^?^^^;^^^
:ii^^ii^KiiiiisiJD:kvF''s,F,|oiecivH|si0^

.,.,,.,

ill

.fill

i^fDAFirst ProiecfVSource

; ||:^|||8: .* : fell'

^-'*:

i. ^vjfiw^fe

i!|jwl

. 17.15. Directories

Directories (. 17.15) :
Archives directory
. ;
History directory ,
;
Lock file directory
;
Enable Mirror Directory ( )
() ;
Mirror directory
Enable Mirror Directory ;

17.

498

Mark Mirror files as Read-Only


.
Users (. 17.16)
. Authorized users (
Usemame) ( Access).
Add.
User Information (. 17.17), :
Username;
Access Rights:
Read-Only ;
Read-Write ;
User is an Administrator .
,

.

Gen*al| Otactate [ ! |

cad
pmn
" pvn

., _ .,

Access..
Read Only
Read Write
ReadWtile

dJOset
DdetaUsel

d ^ $ Administrate useis
* Al<wSis*aetoftiisp(0(Brt
OK

Cancel

. 17.16. Users

Allow Guest access to this project Users


Read-Only.
Publishing (. 17.18) ,
:

;
;

Check-In.
,
.

499

TeamSource

Ummim;

jpmn

Access Ri$iis
Read-Only^Jannotmodii}? protect]
^

Read-Wfite ftan check h)


" Use is 4<>'

OK

Cancel

Help

. 17.17. User Information

-flJ J Dsectoes j *

$htftg

SMTP wtvec

smpf domain ru

Publish S ummattes t p;

user"! @domain ru
user2@domain ru

Mtt Summyul;

D \First Pro|ect\summary txt

Py$f$htog*Tfl;

user1@domam ru
usef2@domam ru

Ma&etU&ftf,

D \First ProiecNogs txt


1

Pubifehf Change* To

il

_J

userl@domain ru
user2@domatn

Ij:
OK

Car>c^

Haste

. 17.18. Publishing

, ,
Controller Options, Project Controllers.
,
TeamSource, ,
TeamSource, ,
.

TeamSource
TeamSource ,
View,
Views:
Q Info . TeamSource
. Info
,
TeamSource ;
Local Project ;

500

17.

Remote Project ;
History .


Local TeamSource
, ,
, .
TeamSource : Recommended changes to your Local project
Recommended changes to the Remote project (. 17.19).
Recommended changes to the Remote project
, ,
, .
. , . 17.19,
:

Calculation.pas, .
(Check-In);
Q SQL.exe, SQL_main.dcu, SQL.dpr, SQL.cfg, SQL.dof,
SQL_main.dfm, SQL_main.pas.
, .
(Check-In);
SQLBDE.res .
.
Recommended changes to your Local project
, .

, . , , . 17.19,
:
SQL. res
.
.
(Touch);
Q SQLBDE.dpr , ,
, ( ).
.
(Correct by hand).

Do It!.

, ,
, ,
.
. , Recommended changes to the Remote project,
:

501

TeamSource

,
, ;

View Local Changes


, ;
View Remote Changes
, ;
View All Changes (
);
View File Info :
, ,
;

Ignore (move to other pane)


;
Revert ;

Edit File Comment ;


Import Comments ;
Select All , .
Bailand T earaSource .?
file

g*4*a

Vie*

\faAPfwec\m

options

UesttfrecloiJ? JD \WirApps\Borland\Pel

V6QL _ ^ j

V*wt

1
' '*' * ,

etfteVW ]Entire

p r o p e l 5 3

<fl Rerhl

' % Iftecafiwnendedchanges tayouiLacalptbiect


I Ojedoiy

filename

SQL res

source

SQLBDE.dpr

source

J Arton
Touch
Correct by hand

' -ST!'- *

j f j Comment}

Recwiirriertded thangti lothefismDte piojicl

Filer

Directory j Acfcon

ULe-e

cormled

;> QL_main.dcu

comiled

| Ca^r&ert

Chech tn
Check in

^ ' alculation pas source

Check in

.y^QLcfg

source

Check in

j? bUL dot

source

Check in

j SQL dpi

snuice

Check in

1? jQL_main dtm uutce

Checl' in

^^-UL_main pas

source

Chech in

O ^ U L E D E re-

suurre

Remove

1
^LM

lock 1
f j j pvn

A b

Hammarit

dmmLock

:
. 17.19. TeamSource Local

Recommended changes to your Local project


, : Change File Status
().

502

17,

,
, Comparing,
.
. 17.20 Comparing ,
. .
-.
+.
Comparing .
Comparing SQL mam pa (local Me anainri 1.01
00079
ADOQuery].Open;
00080
end;
00081
00082
procedure TfrmHain.bcnExecSQLClick(Sender:
00083
begin
00084
ADOQueryl.Active:=false;

ooos4

T0b]ect>;

||||||||||1^8^^^^1^{^^

00085
ADOQueryl.SQL.Clear;
00086
ADOQueryl.SQL.Assign(memSQL.Lines);
00087
ADOQueryl.ExecSQL;
00088
end;
Change jowrenitf
Improved closing of the dataset

.-J
Zi

~B

. 17.20. Comparing


Remote TeamSource
(. 17.21). Local, .

. ,
, root. ,
, .

Read-Only. ,
(, ),
.

, :
View Tip Revision ().
,
(. 17.22);

,
.

503

TeamSource

' Holland TeamSouice - IFiut Piotectl


fa*

yjew 6

) (today; JD \WirApps\Borland\Del \SQL j j

_ J <root>
t 1 comiled

Lock Time

Ffenan
Calculation, pas
SOLclg
SQLdpr
SQL res
SOLBDE.clg
SQLBDEdpi
SQLBDE.res
SQL.BDE dfm
SQL_main.dfm
SQL_mainpas

* Tut

1.0
1.1
1.1
10
10
1.0
10
1.0
1.1
1.1

12 09.2000 20 08
12.09.2000 20:08
12 09 2000 20:08
26.01 200018:15
29.01 200015:08
27.01.200017:01
27 01 200016:39
29.01 200015:04
12.09.200019:36
12.09 200019:38

Comment

Admin Luuk

:|1M
. 1 7 . 2 1 . TeamSource Remote

program SQL;
uses
Forms,
SQL_main i n ' S Q L _ m a i n . p a s ' { f r m l l a i n } .
Calculation in 'Calculation.pas';
(SE *.JLES)
begin
Application.Initialize;
Application. C r e a t e F o r m d f rmHain, frmHain) ;
Application. Run;
end.

:!
. 17.22.

View Any Revision .


Select A Revision (. 17.23),
, .
,
, . 17.22;

Save Revision As
, .
Select A Revision (. . 17.23), ,
;

504

17.

|! ':;(1!
1209.200019:38
03.02.2000 2031

1.0

:;

:^*('

':

. 17.23. Select A Revision

Remove from project ()


;
View Archive Report ;
Q Compare Revisions .
Select Revision Pair (. 17.24),
.
, , . 17.20.

Avatable revision, fa SOL


Revision

Date

BevK- I

Comrnestf

2 ;nnn :: r v

OK

Cancel

. 17.24. Select Revision Pair

Set Revision Number


, .
Select A Revision.
Fix Tip Revisions .

. , ,
(. . 17.23), .
Remote .
,
,
. :
Add ;
Delete .
(root);
Properties .

505

TeamSource

Directory Properties
(. 17.25),
.

:|:::*|:...;:;-.1?:..

] ;

^
&.9'^^
118115: I S l P i f j ' : &**. I: W: ' |%~::;:
. 17.25. Directory Properties

Directory Properties :
Version Controller .
, ;
Q Includes ,
. , Delphi
*.dpr; *.pas; *.dfm;
Excludes ,
.
, Includes *.dfm, Excludes
tmp*.dfm, dfm-, tmp,
;

Productions
,
Includes.
, Define.

History
History , ,
. TeamSource
(. 17.26).
, , .
, .



. ,
.
,
. tic Project Request Lock TeamSource.

506

17.

MM

Boiland TeamSuuicB - IFiitt PioieclJ


tie

frcjecl JAKI flftons

local *ectay JD\WinApps\Bocland\Del

\SQL _^j

$<)*.. J

&

<"comiled>
SQL main.dcu
SQL.exe
<source>
SQLBDE.cfg
SQL main.pas
SQLBDE.dof
SQLBDE.res
SQLBDE.dpr
SQL main.dm
SQL do
SQL cfg
m

Uekfw

Est Time

f^ ! ^

J
(

^ ***"$

*1

Comment

IBOD

. 17.26. TeamSource History

Lock Information (. 17.27),


:
Lock Comment;
Estimated time you will need the lock;
Lock as Administrator
Lock.
.

l,oott Comment:
[Lock lo Check In
$imated6FWypu*$needthebc.k; jT5

M mhute*

" took a t *
OK

Cancel

Htfp

. 17.27. Lock Information


,
Lock list TeamSource. :
(Clear Lock);
(Edit Lock Comment);
G (Extend lock);

507

TeamSource

(Yield to);
(Verify Current
Lock).


(Bookmarks) .
( Pull).
Bookmarks
(. 17.28), Project Bookmarks
TeamSource.
MSSESSI
Current bookmarks
Dale
12 09.2000 19.30
12.09 200016:30

Name

Add

I*

. 17.28.

Add.
Edit.
Bookmark Properties
(. 17.29), ( ) :

Name;
, , Date;
( ) Scope (Local
Global).
ookmark Pippeiqe*
Hi me

JBetal

to

J12 OS 2000 16 30

Scop*
t j^ecat
-flofxl

OK

Cancel

. 17.29. Bookmark Properties


. . -

508

17.

,
.


,
. ,
, ,
.

TeamSource Project Pull to.
Pull (. 17.30).

f'ff 'yi : % e > o i : i : ^ want to puS.toS


.,'';; . hav* made, tri thii dteetoryr;;SSSS:?NS :: :
::':;:';::':;';%:';" :?':

S'Ortjws:::;

OS

. Cancel

"ftsip

, 17.30. Pull

:
Bookmarks, ,
. ,
None;
Fast Pull
, (
).

V
COM, ActiveX

18


Microsoft Office
MS Office,
.
, MS Office,
. MS
Office ,
. , MS Office
OLE Automation,
MS Office ,
, OLE
Automation.

,
(OLE Automation):
Windows.

.
(Component Object Model),
. lUnknown.

, IDispatch.

Microsoft Office

511

:
Q ;
;
.
,
, .
,
.

()
().
, ,
. MS Office
VBA.
, ,
.

Microsoft Office
Microsoft Office
, .
Microsoft Office :
MS Word;
MS Excel;
PowerPoint ;
MS Outlook ,
, , . .
, Microsoft Office
MS Access.
Microsoft Office , ,
, ,
, . .
, Microsoft Office
. , Excel,
, Word.
-
MS Office ODBC.
, .
MS Office .
, ,
.
, ,

512

18. ...

(, MS Office). , Microsoft
Word ,
.
, Word
. , MS Office
OLE Automation.
OLE Automation
Microsoft Office .
,
MS Office,
.

MS Office.
: - ,
MS Office ?
,
Microsoft ( Access).

. , :

MS Office .
(dBase,
FoxPro, Paradox) MS SQL Server. , , ODBC

(
ODBC);

MS Office
( );
MS Office ,
;
MS Office Windows 95/98/NT/2000.

. Delphi
:
Delphi
BDE, ,
ODBC ( ODBC ). ,
( ,
)
, BDE;

, Delphi,
. , ,
, ,
, ;

513


;
Borland
Kylix, Delphi Linux.
Delphi Kylix
(,
CLX VCL Kylix ).

,
,
MS Office.
MS Office
:
Q DDE (Dynamical Data Exchange)
, Windows 3.X,
;

OLE Automation OLE :


.



,
OLE Automation.
Delphi.
, :
.
.



Delphi
.
, ,
.
Delphi
CreateOleObject:
function CreateOleObject(const ClassName: string): IDispatch:
ClassName
, . CreateOleObject
IDispatch,
.

514

18. ...

CreateOleObject ComObj,
uses.

, (
, CreateOleObject),
OleVariant,
.

.


MS Word
CreateOleObject. Delphi ,
- OnCl ick:
procedure TForml.ButtonlClick(Sender: TObject);
var w : OleVariant:
begin
W:=Create01e0bject('Word.Basic'):
W.AppShow;
W.FileNew;
W.Insert(' '+#13):
W.Insert(' '+#13):
end:

,
, ,
MS Word, ,
, Insert.
.
CreateOleObject
Basic Word.
Word,
Basic , Delphi.
Created eObject MS Word.
.
, AppShow.
( Fi I eNew)
( Insert).

, Delphi
Word, ,
.
. ,

.

515

,
MS Word WordBasic,
Word ( 6- ).
Word MS Office Visual Basic for Application (VBA)
Visual Basic. WordBasic.
WordBasic .
VBA , ,
. VBA
CreateOleObject Word.Application.




, .
,
. :

Type Library (.tlb);


Object Type Library (.olb);
ActiveX (.ocx);
, (.)
(.dll).
:
, ;
,
:
.
, Pro
ject Import Type Library Delphi IDE.
Import Type Library (. 18.1),
ActiveX,
. , , Class
names.

Install Create Unit. Delphi
,
Object Pascal, .
, Install Delphi
( ),
. ,

ActiveX.

516

18. ...

tepsrtTypelrbraiy
Microsoft SOL Parser Obiect Library 1 0 (Version 1 0)
Microsoft VBScript Global (Version 0 0)
Microsoft VBScript Regular Eypiessions (Version 0 0)
Microsoft Visual Basic for Applications Extensibility 5 3 (Version 5
Microsoft VML Renderer Obiect Library (Version 1 )
Microsoft Windows Common Controls 6 0 (Version 2 01
Microsoft word 9
Microsoft XML, version 2 0 (Version 2 0)

zi

lass names: TWordGlobal


TWor duplication
TWoidDocument

gtett*f>age; Jcti><eX

~*J

Uril djt ftame; |d \winapps\borland\Delphi5\lmports\

... 1

J2ercj} path

| 5 14\D5,d \winapps^borland\halcn600^source

|1

Cleat *

Cancel

f ? SerwefeComporestHWrappsi

. 18.1.


, ,
. Object Pascal
, ,
, .
System Delphi 5 Empty Pa ram.

, ,
.

,
, .
Object Pascal, interface.

5- Delphi Microsoft Office


,
(
...\Delphi5\Imports). Delphi
.


Delphi 5 ,
MS Office. -

517

Servers .
MS Word
. ,
: , Delphi, MS Word,
.
:
1. .
2. Delphi 5, uses
Word2000 Word97 ( MS Office,
).

Delphi Project Import Type


Library, Microsoft
Word Object Library Create Unit.
WordJTLB.

3.
OnClick:
procedure TForml.ButtonlClick(Sender: TObject);
var
W : _Application:
D : OleVariant:
begin
W:=CoWordApolicatIon.Create:
W.Visible:=true;

W.Documents.Add(EmptyPa ram.EmptyParam,
EmptyParam.EmptyParam):
W.Selection.InsertAftert' '+#13):
W.Selection.InsertAfter(' '+#13):
0:=wdCollapseEnd:
W.Selection.Collapse(D):
end:

, ,
, .
Word _Application.
,

.
:

Create
CoWordAppl I cation, .
MS Word W
_Appl ication Word;

G MS Word , Visible _Appl ication


true;

518

18. ...

Add Documents
, MS Word;

InsertAfter Sel ecti on,
, , .
, , .
Col 1 apse Sel ecti on.

_Application
Visual Basic for Application (VBA), MS
Office . VBA
.


, .

, .
,
.

Delphi
MS Office
Delphi 5 ,
MS Office.
Servers Delphi IDE.

MS Office ( Document, ExcelWorkBook . .).

- TOLEServer.
, .
TOLEServer .
,
Appl I cati on ( WordAppI i cat! on, Excel Appl i cati on,
PowerPointApplication, OutlookApplication).
Name Tag :

AutoConnect : Boolean, (true) (false)


;
AutoQuit : Boolean , (true) (false)
;

Q ConnectKind : TConnectKind
. :

Delphi MS Office 5 1 9

ckRunni ngOrNew - ,
,
;

ckNewInstance ;
ckRunni nglnstance }' ;
ckRemote ;
ckAttachToInterface .
ConnectTo.
AutoConnect true.
ConnectKInd Appl ication;

RemoteMachineName , .
ConnectKmd ckRemote.
, Servers

MS Office, ,
AutoQuit, .
- MS
Office
,
Delphi. , Word,
,
:
WordApplicationl.Connect:
WordApplicationl.Visible:=true;
WordAppl i cationl.Documents . Add(EmptyParam. EmptyParam.
EmptyParam.EmptyParam);
WordApplicationl.Selection.InsertAfter(' '+#13);
WordApplicationl.Selection.InsertAfter(' '+#13):

Connect Word.
Connect! onKind
MS Word .

AutoConnect true Connect


.


.

:
Connect MS Word.
, AutoConnect WordAppl i cati on
false;

520

18. ...

ConnectTo .
, ;
Di sconnect .

, - WordApplication, ExcelApplication, PowerPointApplication, OutlookApplication


Application.
,
Visual Basic for Application (VBA) MS Office.
Delphi -.
, ,
VBA, MS Office.

-
.
.

MS Office
, VCL,
MS Office,
Delphi.
MS Office.
5- Delphi ,
MS Office,
(,
Servers Delphi IDE).

MS Word
MS Word ,
, ,
.
VBA,
MS Office.
, MS Word,
Application. ,
(. 18.2). Delphi
Appl ication MS Word TWordAppl ication.

Application
Application ,
MS Word .
, .

521

MS Office

Application
KeyBoundTo (KeyBinding)

Addins (Addin)

KeyBindinds (KeyBinding) ~ |

AnswerWizard

SpellingSuggestions (SpellingSuggestion)
"~~|

Assistant

System

~|

COMAddlns

Tasks (Task)

~|

Browser

Templates _(Template) ~~)


PivotCaches (PivotCache) ~~|
MailingMessage

-|

AutoCorrect

Synonyminfo

CustomLabels (customLabel)
EmailOptions
EmailSignature
Languages (Language)
Dictionaries (Dictionary)

Dialogs(Dialog)
Documents (Document)
CommandBars (CommandBar)
LanguageSettings
CaptionLabels (CaptionLabel)
Windows (Window)
Dictionaries (Dictionary)
FontNaames

MailMessage

FileSearch

Options

VBE

ResentFiles (ResentFile)"

FileConverters (FileConverter)

Selction
ListGallies (ListGallery)

j HangulHanjaConversionDictioneries (Dictionary)l
DefaultWebOptions

ListTemplatetes (ListTemplate)

ListLevels (ListLevel))
. 18.2. Application MS Word

Appl ication :
Visible : Boolean MS Word.
false, , MS Word
, ;
ActiveOocument : Document Document,
;
Options : Options , MS Word;

Documents : Documents Document,


;

Selection : Selection
.

522

18. ...

TWordApplication
Application MS Word.
, .
,
MS Word.

Application : Qui t(SaveChanges. Format)


MS Word. SaveChanges ,
. :
wdDoNotSaveChanges ;
wdPromptToSaveChanges , ;
wdSaveChanges .
Format , :
wdOriginalDocumentFormat ;
wdPromptUser ;
wdWordDocument Word.
MS Word
, Appl ication,
Documents, Document.

Documents
Documents (
Document). Documents ,
Count, Integer
.
Documents,
, , , .
:

Add (Tempi ate: OleVariant: NewTemplate: OleVanant; DocumentType: OleVariant:


Visible: OleVariant) .
:
Template , .
(,
EmptyParam), normal.dot;
NewTemplate , (false)
(true). fal se;
DocumentType .
: wdNewBlankDocument, wdNewEmai I Message, wdNewFrameset, wdNewWebPage.
wdNewBlankDocument;
Visible ,
(true) (false). true;

MS Office

523

false ,
true .

Open (FileName: OleVariant: ConfirmConversions: OleVanant: Readonly: OleVariant;


AddToRecentFiles: OleVanant: PasswordDocument: OleVariant: PasswordTemplate:
OleVariant: Revert: OleVariant: WritePasswordDocument: OleVariant: WritePasswordTemplate:
OleVariant: Format: OleVariant: Encoding: OleVariant; Visible: OleVariant)
( ) . Open
Fi leName,
. :
Conf i rmConversi ons , (true) (false)
, MS Word;
Readonly true ,
;
AddToRecentFi Ies , (true) (false)
,
;
PasswordDocument ;
PasswordTempl ate ;
Revert
:
, , (true)
(false);
WritePasswordDocument
;
Wri tePasswordTempl ate ;
Format , .
, . 18.1.
wdOpenFormatAuto;

1 8 . 1 . ,

wdOpenFormatAIIWord

MS Word

wdOpenFormatAuto

wdOpenFormatDocument

MS Word 2000

wdOpenFormatEncodedText

wdOpenFormatRTF

RTF

wdOpenFormatTemplate

MS Word

wdOpenFormatText

ASCII

wdOpenFormatUnicodeText

UNICODE

wdOpenFormatWebPages

HTML-

524

18. ...

Encodi ng , MS Word
. ;
Visible , ;
Save (NoPrornpt: OleVariant; Original Format: OleVariant)
. , ,
.
;
NoPrornpt , (false) (true)
;
0 Original Format .
; wdOrigi 1DocumentFormat
; wdPromptUser
; wdWordDocument MS Word;

CloseCSaveChanges: OleVariant; Original Format: OleVariant: RouteDocument:

01 eVari ant) .
:
SaveChanges , .

: wdDoNotSaveChanges ;
wdPromptToSaveChanges ,
; wdSaveChanges ;

Ori gi nal Format .


Save;
RouteDocument ,
(true) (false);
ItemCIndex: OleVariant) Document.
Index ,
. ,
OleVariant (
). 1.
.

Document
Documents
Document, , MS Word.
Document
. Document
VCL Delphi TWordDocument.
Document, , ,
.
,
, , ,

MS Office

525

. , Document,
, , .
Document . 18.2.
18.2. Document

AttachedTemplate

Template

AutoHyphenation

Boolean

(true) (false)

Content

Range

FullName

WideString

GrammarChecked

Boolean

,
(true) (false)

GrammaticalErrors

Proof readingErrors

Range,

, .

.

Name

WideString

PageSetup

PageSetup

,
(, . .)

Paragraphs

Paragraphs

Paragraph,
.

Readonly

Boolean

(true) (false)
(read only)

Saved

Boolean

, (false) (true)

SaveFormat

Integer

ShowSpellingErrors

Boolean

(true) (false)

ShowGrammaticalErrors

Boolean

(true) (false)

Styles

Styles

Style,

Tables

Tables

Table,

TablesOfContents

TablesOfContents

TablesOfContent,

Type_

TOLEEnuq

:
wdTypeDocument ;
wdTypeTemplate

Words

Words

Word,

526

18. .,.

Document
. :

CheckSpelling .
MS Word
;
Close(SaveChanges. OriginalFormat. RouteDocument) .
Close Documents;
Range(Start: OleVariant: End: OleVariant) Range,
,
Start End.
Range;
Save(NoPrornpt, Original Format) Save Documents;
Acti vate ;

Undo (Times: OleVariant) .


true, .
Times.
OLE-
01 eVari ant. , 100 new text, Range
:
var
R. S. : OleVariant:
S:=0;
:=100;

R:=WordDocument1.Range(S,):
R.InsertAfter('new text'):

,
R. ,
Range.
OleVariant, ,
:
var
S. : OleVariant;
R : Range;

S:=0:
:00:
R:=WordDocumentl.RangeCS.E);
R.InsertAfterC'new t e x t ' ) ;


:
WordDocutnentl.Range(S,E). InsertAfterC 'new t e x t ' ) :
Range Document, InsertAfter
Range.

MS Office

527

MS Word
Appl i cati on Document
: , ,
. .
Application Document MS
Word, .
,
Appl ication Document. ,
, Paragraph, Sel ection
Range.

Paragraphs Paragraph
Paragraph Paragraphs (,
, Document). Paragraphs
. Paragraphs
, Add,
. :
function AdcKvar Range: OleVanant): Paragraph
Range ,
. Add
Empty Pa ram,
.
Paragraphs Paragraph
. Delphi Paragraphs
Item:
function I tern t Index: integer): Paragraph
, Index.
,
:
var
: Paragraph:
begin
WordDocumentl.ConnectTo(WordApplicationl.ActiveDocument):
P:=WordDocumentl.Paragraphs.Item(l):
end:

Paragraph ,
.
. 18.3.
Paragraph ,
, .
VBA MS Word.

528

18. ...

18.3. Paragraph,

Alignment

TOIeEnuq

.
:
wdAlignParagraphLeft ;
wdAlignParagraphCenter ;
wdAlignParagraphRight ;
wdAlignParagraphJustify

FirstLinelndent

Single

.
( ),
( )

Hyphenation

Boolean

, (true) (false)

Leftlndent

Single

Rightlndent

Single

LineSpacingRule

TOIeEnuq


.
:
wdLineSpace1pt5 ();
wdLineSpaceDouble ();
wdLineSpaceAtLeast ();
wdLineSpaceExactly ();
wdLineSpaceMultiple ();
wdLineSpaceSingle ()

LineSpacing

Single

( ).
,
LineSpacingRule :
wdLineSpaceAtLeast
,
LineSpacing;
wdLineSpaceExactly
,
LineSpacing ;
wdLineSpaceMultiple
LineSpacing ,
( )

SpaceAfter

Single

( )

SpaceBefore

Single

( )

Range Selection
, MS Word,
Range Selection. ,
MS Word. .
, ,
, . :

Range .
Range Document,
;

MS Office

529

Sel ecti on .
Application.

.

, Range Selection ,
Document. ,
Document, Range Selection.

Range ,
, ,
. . 18.4.
18.4. Range,

Bold

Integer

, (1) ().
, wdUndefined
.
wdToggle,

Italic

Integer

, ,

Underline

TOIeEnuq

Font

_Font

, .
Delphi
WordFont,

Sel ecti on ! d, Ital i Under I i ne.


Selection Range,
Range, . ,

:
WordApplicationI.Selection.Range.Bold:=l:
Selection Font,
Range.
Range Selection ,
: Start End_ ( Integer).
, .
Range Selection ,
.
TypeText,
Selection.
. :
procedure TypeText (const. Text: WideStrlng)

530

18. ...

TypeText Repl aceSel ecti on


Opti ons: true, ,
Text; false,
( Repl aceSel ecti on
true).
, TypeText, .
, ,
, :
WordAppli cati onl.Connect:
WordApplicationl.Documents.Add(EmptyParam,
EmptyPa ram.EmptyPa ram.EmptyPa ram):
WordAppli cationl.Vi si e:=true:
WordApplicationl.Selection.TypeText(' '+#13):
WordAppli cati onl.Selecti on.TypeText(' TypeText'+#13);

TypeText Selection
: InsertBefore InsertAfter.
, TypeText Wi deStri ng,
. InsertBefore
, InsertAfter . TypeText
InsertBefore InsertAfter
.
:
WordAppli cati onl.Connect;
WordApplicationl.Documents.Add(EmptyParam.
EmptyPa ram.EmptyPa ram.EmptyPa ram);
WordAppli cati onl.Vi si bl e:=true:
WordApplicationl.Selection.InsertAfter(' '+#13):
WordAppli cationl.Selecti on. InsertAfter(' InsertAfter'+#13);

, InsertBefore InsertAfter,
,
, .
, .
InsertBefore InsertAfter Range.
, Selection:
, .
Selection Range ,
:
Paste Sel ecti on Range.

;
Selection Range .
! 1 apse
.
Start End_ . Col I apse :
procedure Collapse(var Direction: OleVariant)

MS Office

531

Direction ,
.
:

wdCollapseEnd ;
wdCol lapseStart ( ).

MS Word
,
. MS
Word , .
Tables,
, ,
.

Tables
Tables , .
,
. Tables
,
.
Tables : Count, Integer
Table ( ),
.
Tables :
function Add (const Range: Range: NumRows: Integer: NumColumns: Integer: var
DefaultTableBehavior: OleVariant: var AutoFitBehavior: OleVariant)
. :
Range , .
Add , , Col I apse,
, , ;
NumRows ;
NumColumns ;
Defaul tTabl eBehavi or ,
.
: wdWord8Tabl eBehavi or ;
wdWord9Tabl eBehavi or .
;

AutoFitBehavior
;
function (index: Integer): Table
index.

532

18. ...

.
,
. :
// Word
WordApplicati onl.Connect:
//
WordApplicationl.Documents.Add(EmptyParam,
EmptyPa ram.EmptyPa ram.EmptyPa ram);
WordApplicationl.Visible:=true:
//
WordApplicationl.Selection.TypeTextC' '+#13):
//
WordAppli cationl.Select i on.Tabl es.Add(
WordApplicationl.Selection.Range.3.4.
EmptyPa ram.EmptyPa ram);

,
Range Range Selection (
).
, - ,
Range Document.
, document.doc,
:
var
D : OleVanant:
R : Range:
begin
// Word
WordAppli cati onl.Connect:
// document.doc
D: ='document.doc' ;
WordApplicationl.Documents. Item(D):
WordApplIcationl.Visible:=true;
//
D:=wdCol1apseEnd:
R:=WordApplicationl.Acti veDocument.Content;
R.Collapse(D);
//
R.Tables.Add(R.3.4.EmptyPa ram.EmptyPa ram):
end:

Table
, , .
- .
Tabl .
. 18.5.
Table :
function Cell(Row. Column: integer): Cell
Cel 1, .
Cel 1 Range,
Range, .

MS Office

533

18.5. Table

Columns

Columns

Column,

Rows

Rows

Row,

Borders

Borders

Border,

Cel l Sel ect,


.
,
:
InsertBefore InsertAfter Range,
Cel 1;
LI Select Cel 1
Selection.
Word
OLE Automation.
sales.mdb.
DBGnid, Word
.
:
Button ();
ADOTable ( ADO);
DataSource ( );
DBGri d ( );
WondAppl ication ( MS Word).
ADOTable MS Access

, .
.
unit Offnce_u;
interface
uses
Windows. Messages. SysUtils. Classes, Graphics.
Controls, Forms, Dialogs, Word2000. OleServer,
StdCtrls. Grids, DBGrids. Db. ADODB;
type
TForml = class(TForm)
Buttonl: TButton;
WordApplicationl: TWordApplication;

534

18.
WordDocumentl: TWordDocument:
ADOTablel: TADOTable:
DataSourcel: TDataSource;
DBGridl: TDBGrid;
procedure ButtonlClick(Sender: TObject);
procedure FormShow(Sender: TObject):
procedure FormC1ose(Sender: TObject: var Action:
TCloseAction):
private
{ Private declarations }
public
{ Public declarations }
end:

Forml: TForml:
implementation
{$R *.DFM}
procedure TForml.ButtonlClicktSender: TObject):
var
R : Range:
T : Table:
numRec.numField.i.j : integer;
: Cell;
begin
//
nurnRec: =AD0Tabl el. RecordCount;
//
numFi eld:=AD0Tablel.Fi eldCount;
WordAppli cati onl.Connect:
WordAppli cati onl.Documents.Add(EmptyParam,
EmptyParam.EmptyPa ram.EmptyParam):
WordAppli cati onl.Vi si e:=true;
// ,
//
WordApplicationl.Selection.TypeText(' 1. '):
R:=WordAppli cati onl.Selecti on.Range;
R.Tables.Add(.numRec+1.numFi eld.EmptyPa ram,
EmptyParam):
T;=WordAppli cati onl.Acti veDocument.Tables.Item(1);
// -
//
for j:=0 to numField-1 do begin
C:=T.Cell(l.j+l):
C.Range.InsertAfter(ADOTablel.Fields[j].FieldName);
end;
// Word
for i:=1 to nurnRec do
for j:=0 to numField-1 do begin
C:=T.Cell(i+l,j+l);
ADOTablel.RecNo:=i;
C.Range.Inse!-tAfter(ADOTablel.Fields[j].AsString):
end;
end;

MS Excel

535

procedure TForml.FormShowCSender: TObject);


begin
//
ADOTablel.Open;
end:
procedure TForml.FormClosetSender: TObject: var Action: TCloseAction):
begin
//
ADOTablel.Close.
end:
end.

MS Excel
MS Excel, MS Word,
(. 18.3). MS Excel
MS Word. ,
MS Excel, Appl ication.
MS Excel. , ,
. -, ,
.
,
MS Excel .
:
Workbooks Workbook,
MS Excel. MS Excel
MS Word;
D Sheets Sheet,
;
Cel I s Range,
. ,
, ;

Charts Charts,
.
VCL Delphi ,
MS Excel:

TExcel Application

Application;

TExcel Workbook Workbook;

TExcel Worksheet Sheet;

TExcel Chart Chart.

, MS Word,
Servers
MS Excel.

536

18. . . .
Application
Workbooks (Workbook)

Addins (Addin)

Worksheets (Worksheet)

AnswerWizard

Charts (Cart)

AutoCorrect

Document Properties (DocumentPropertie)

Assistant

VPBroject

COMAddlns

CustomView

Debug

CommandBars (CommandBar)

Dialogs(Dialog)

HTMLProject

CommandBars (CommandBar)

PivotCaches (PivotCache)

LanguageSettings

Styles (Style)

Names (Name)

Bordes (Border)
Font
Interior

Windows (Window)

Panes(Pane)
WorksheetFunction

Windows (Window)

RecentFiles

Panes (Pane)

FileSearch

Names (Name)

VBE

RoutingSlip

ODBCErrors (ODBCError)

PublishObjects (PublishObject)

OLEDBErrors (OLEDBError)

WebOptions

DefaultWebOptions

. 18.3. MS Excel

MS Excel
, MS Excel,
, Workbooks.
,
Workbooks Appl ication.

Workbooks
Workbooks:
function Add (Tempi ate: OleVariant; Icid: integer): _Wo rk book
. Tempi ate
, .
, (
),
. -

MS Excel

537

: xlWBATExcel4IntlMacroSheet, xl WBATExcel4MacroSheet, xl WBATWorksheet,


xlWBATChart.
. Tempi ate (,
Empty Pa ram), ,
SheetsInNewWorkbook. Icid
;
function OpenCFileName: WideString: UpdateLinks: OleVariant: Readonly: OleVariant;
Format: OleVariant; Password: OleVariant; WriteResPassword: OleVariant;
IgnoreReadOnlyRecommended: OleVariant; Origin: OleVariant; Delimiter: OleVariant:
Editable: OleVariant; Notify: OleVariant; Converter: OleVariant; AddToMRU:
OleVariant: Icid: integer): _Workbook
. , , .
:
Fi leName ;
UpdateLinks .
,
.
: 0 ; 1
, ; 2 ,
; 3 ;
Readonly ,
(false) (true);
Format -.
: 1 ; 2 ; 3 ; 4
; 5 ; 6
( Delimiter);

Password .
,
;
WriteResPassword .
,
;
IgnoreReadOnlyRecommended ( true)
;
Origin , ,
.
xl Maci ntosh, xl Wi ndows xl MSDOS.
,
;
Delimiter - (
Format , 6);
Q procedure CloseCIcid: integer)
Icid;

538

18. ...

function Itemdndex: OleVariant): _Workbook


index , index.
Workbooks : Count,
Integer
.
Excel ,
Delphi.
TExcelAppl ication. :
//
// Excel
ExcelAppli cati onl.Connect:
//
Excel Applicationl.Workbooks.Add(EmptyParam.O);

,
,
MS Excel .
true Visible Excel Appl icati on:
ExcelApplicationl.Visible[0]:=true;
, Visible Excel Appl i cati on,
WordAppl i cati on, .
,
.

Workbook
Workbooks Workbook,
Excel. :
ActiveSheet ,
;
Sheets Sheets,
( );
Worksheets Sheets,
.
Workbook :
procedure Activatedcid: integer) ;
procedure CloseCSaveChanges. FileName, RouteWorkbook: OleVariant: Icid: integer)
.
:
SaveChanges ;
Fi I eName , ;
RouteWorkbook (true) (false)
;
procedure Savedcid: integer) ,
;

MS Excel

539

procedure SaveAs(Filename. FileFormat. Password. WriteResPassword. ReadOnlyRecomiended.


CreateBackup: OleVariant; AccessMode: OleEnum, ConflictResolution. AddToMru.
TextCodePage, TextVisual Layout: OleVariant; Icid: integer)
.
SaveAs
/ .

MS Excel
MS Excel :
(Worksheet), Excel.
Worksheet;
(Chart), .
Chart.
:
Sheets ,
, ;
Worksheets ,
;
Charts , .
,
Sheets. Sheets Add,
:
function Add(Before. After. Count. Type_: OleVariant: Icid: integer): IDispatch.
(
EmptyParam) :

Before , ;
After , ;
Count .
;
_ .
: xl Worksheet, xl Excel4MacroSheet
x!Excel4IntlMacroSheet. xlWorksheet.
Item[index: OleVarint]: IDispatch,
.

Worksheet (ExcelWorksheet)
Worksheet . Worksheet
Worksheets. Delphi
TExcelWorksheet.
(, , )
. , , , Items, -

540

18. ,,.

Sheets, IDi spatch, Worksheet Chart.


Sheets Delphi
:
1. TExcel Worksheet
ConnectKide ckAttachToInterface.
2. Worksheet ConnectTo
TExcelWorksheet.
ConnectTo TExcel Worksheet :
procedure ConnectTo(svrIntf: _Worksheet);
_Worksheet
, . ,
svrlntf _Worksheet, IDispatch. ,
_Worksheet Idi spatch,
as, ,
.

ConnectTo MS Office,
VCL, ,
TExcelWorkbook.

ConnectTo:
/ / Excel
ExcelApplIcatlonl.Connect:
/ /
Excel ApplI cati onl.Workbooks.Add(EmptyParam,0):
/ / Excel
ExcelApplicatlonl.VI si e[0]:=true:
// ExcelWorkbookl
.//
ExcelWorkbookl.ConnectTo(
ExcelApplicationl.ActiveWorkbook):
/ /
ExcelWorkbookl .Worksheets.Add(ErnptyParam.EmptyParam,
EmptyPa ram,EmptyPa ram,0):
/ / ExcelWorksheetl
/ /
index:=l:
ExcelWorksheetl.ConnectTo(
ExcelWorkbookl.Worksheets.Item[index] as _Worksheet):

Excel 1.

Worksheet:
Cel I s: Range ;
Col limns: Range ;
Rows: Range ;

MS Excel

541

RangeCCel 11: OleVariant: Celll: OleVariant]: Range


.
Worksheet Activate,
:
procedure Activatedcid: integer)


, MS
Excel, Range.
, , , ,
.
Range ,
. :
Value: OleVariant . ,
EmptyParam.
, ;
Formula: OleVariant ,
.
Range ,
:
function Delete(Shift: OleVariant): OleVariant,
Range. Shift
.
: xlShiftToLeft xlShiftUp;
function Insert (Shi ft: OleVariant): OleVariant
.
, Shift:
xlShiftToRight ;
xlShiftDown ;
function Select: OleVariant ,
Range;
procedure Merge(Across: OleVariant)
. Across .
true, ,
; f al se,
. , ,
, .

Excel
MS Excel
.
MS Excel.

542

18. ...

. Excel ,
sales.mdb. ,
, ,
. :
1. (Table, Query, ADOTable
ADOQuery) .
Access ,
ADO.
Excel , ,
SQL-.
ADOQuery.
2. Excel
, :
select *
from

3. (Button)
OnClick:
procedure TForml.ButtonlCIick(Sender: TObject);
const
// ,
//
CellName : [0..11] of char = '.''.
'.'D'.''.'F'.'G'.''.'I'.'J'.''.'L'):
var

index : OleVariant:
CI. V : OleVariant:
i. j : Integer:
begin
// MS Excel
ExcelAppli cati onl.Connect:
//
ExcelAppli cat i onl.Workbooks.Add{EmptyParam.0):
ExcelApplicationl.Visible[0]:=true:
ExcelWorkbookl.ConnectTo(
ExcelAppli cati onl.Acti veWorkbook);
index:=l:
ExcelWorksheetl.ConnectToC
ExcelWorkbookl.Worksheets.Item[index] as _Worksheet):
ExcelWorksheetl.Activate(O);
//
ADOQuery1.Open:
// Excel
try
for i:-l to ADOQueryl.RecordCount do begin
ADOQueryl.RecNo:=i:
for j:=0 to pred(ADOQueryl.FieldCount) do begin
Cl:=CellNamefj]+IntToStr(i):
V:=ADOQueryl.Fields[j].Value;
ExcelWorksheetl.Range[Cl,CI].Val ue: =V;
end:
end;

MS Excel

543

finally
//
ADOQueryl.Close;
end:
end;

MS Excel
MS Excel ,
, . ,
, .
MS Excel ,
(Worksheet).
Charts Workbook.
, , ChartObjects
Worksheet.
Delphi Excel TExcel Chart.
Charts ChartObjects
IDispatch Chart,
, Delphi TExcel Chart,
ConnectTo .
Charts
Worksheets. , ,
:
ExcelAppli cati onl.Connect;
ExcelApplicati onl.Workbooks.Add(EmptyParam,0);
ExcelApplicationl.Visib1e[0]:=true;
ExcelWorkbookl.ConnectTo(
ExcelApplicati onl.Acti veWorkbook);
ExcelWorkbook 1.Charts.Add(EmptyParam.EmptyParam,
EmptyPa ram,EmptyPa ram,0);
index.-=l:
ExcelChartl.ConnectTcK
ExcelWorkbookl.Charts.Item[index] as _Chart);
ExcelChartl.Activate(O);

, ,
, (Charts
Worksheets) (_Chart _Worksheet).
Charts (TExcelChart) ,
:
Legend: Legend Legend,
;
ChartTi tie: ChartTi 11 ChartTi 11 ,
;
ChartType: TO! eEnum . ,
,
. 18.6;

544

18. . . .

HasAxis[indexl: OleVariant; index2: OleVariant: Icid: integer]


, . i ndexl
: xl Category ;
xlValue ; xlSeriesAxis .
. i ndex2
: xl Primary xl Secondary.
;

HasDataTable: WordBool (true) (false)


;
HasLegend[Icid: integer]: WordBool (true) (false)
;
HasTitle[Icid: integer]: WordBool (true)
(fal se) .

1 8 . 6 . ChartType

xlColumnClustered

xl3DColumnClustered



100 %


100 %

xl3DColumn
xlColumnStacked
xl3DColumnStacked
xlColumnStackedlOO
x!3DColumnStacked100
xlBarClustered
xlBarStacked
xlBarStacked100
xl3DBarClustered

xl3DBarStacked

100 %

xl3DBarStacked100

xlLine

xlLineMarkers

xl3DLine

xlLineStacked

xlLineMarkersStacked

100 %

xlLineStacked 100

xlLineMarkersStacked 100

xIPie

xIPieExploded

xl3DPie

xIPieOfPie

xlBarOfPie

xl3DPieExploded

MS Excel

545

Chart ChartWizard,
.
:
procedure ChartWizarcKSource. Gallery, Format, PlotBy,
CategoryLabels, SeriesLabels, HasLegend. T i t l e ,
CategoryTitle. ValueTitle.
ExtraTitle: OleVariant)

.
. 18.7.
1 8 . 7 . ChartWizard

Source

,
.

Gallery

.
: xIArea, xlBar, xlColumn, xlLine, xIPie, xIRadar,
xlXYScatter, xlCombination, xl3DArea, xl3DBar, xl3DColumn, xl3DLine, xl3DPie,
xl3DSurface, xlDoughnut xlDefaultAutoFormat

Format

, ( ).

1 10.

PlotBy

: .
xIRows xlColumns

CategoryLabels

,
.
0 ,

SeriesLabels

,
, .
0 ,

HasLegend

, (true) (false)

Title

CategoryTitle

ValueTitle

ExtraTitle

MS Excel ,
Delphi.
:
1. Excel , .
2. ChartWizard .

546

18. ...



(, 15). ,
ADOQuery,
, .
1. ADOQuery
.
:
SELECT . C0UNTC[ ]) AS [ ]
FROM
GROUP BY
2. (Button)
OnClick:
procedure TForml.ButtonlClicktSender: TObject);
const
Cell Name : array[0..11] of char - ('A'.'B'.'C.'D'.'E'.
'F'. 'G'.'H'.T.'J'. 'K'. 'L'):
var
index : OleVariant:
CI, V : OleVariant;
i.j.N : Integer;
begin
// MS Excel
ExcelAppli cati onl.Connect;
//
ExcelApplicationl.Workbooks.Add(EmptyParam,0);
ExcelApplicationl.Visible[0]:=true;
ExcelWorkbookl.ConnectTo(
ExcelApplicationl.ActiveWorkbook);
//
Exce1 Workbook1.Worksheets.Add(EmptyPa ram.EmptyPa ram.
EmptyParam.EmptyParam.O);
index:=l:
Excel Worksheet!.. Connect To(
ExcelWorkbookl.Worksheets.Item[index] as _Worksheet):
Excel Worksheet!.Acti vate(0);
//
ADOQuery1.Open;
N:=AD0Query1.RecordCount;
try
for i:=1 to N do begin
ADOQueryl.RecNo:=i;
for j:=0 to pred(ADOQueryl.FieldCount) do begin
Cl:=CellName[j]+IntToStr(i):
V:=ADOQueryl.Fields[j].Value;
Excel Worksheet!.Range[Cl.CI].Value:=V;
end;
end;
finally
ADOQueryl.Close:
end:
//

MS PowerPoint

547

ExcelWorkbookl.Charts.Add(EmptyParam,EmptyParam.
EmptyParam,EmptyParam,0):
index:=l;
ExcelChartl.ConnectTo(
ExcelWorkbookl.Charts.Item[index] as _Chart):
ExcelChartl.Activate(O);
//
// ,
Cl:='Al:B'+IntToStr(N):
//
ExcelChartl.ChartWi za rd(
ExcelWorksheetl.Range[Cl.EmptyParam],
xl Column,EmptyParam.xlColumns);
end;

MS PowerPoint
PowerPoint
, ,
. ,
, .
, Word Excel, PowerPoint
,
, PowerPoint
.
MS Office, PowerPoint
(. 18.4). ,
, . PowerPoint
:

Appl ication MS Office, PowerPoint


, ;
Presentation PowerPoint;
Q SI ide ( PowerPoint
).
Presentation Slide PowerPoint
Presentations Slides . Presentations
, . Slides ,
.
PowerPoint VCL Delphi
OLE-:

TPowerPointApplication Application;

TPowerPointPresentation Presentation;

TPowerPoi ntSl i de SI i de.

OLE-,
Servers Delphi IDE.

548

18. . . .
Application
-|

Addins (Addin)

FileSearch

-\

AnswerWizard

LanguageSettings

-\

Assistant

Presentations (Pesentation)

COMAddlns

SlideShowWindows
SlideShowWindow

-| CommandBars (CommandBar)
-|

DefaultWebOptions

Presentation

DocumentWindows
(DocumentWindow)

SlideShowWindow
VBE

-|

Panes (Pane)

-|

Presentation

-|

Selection

ShapeRange (Shape)

Table
-|

Columns (Column)

CellRange (Cell)

-|

Borders (LineFormat)

Shape

Rows(Row)
4

CellRange (Cell)

-|

Borders (LineFormat)

-|

Shape

-|

SlideRange (Slide)

TextRange

View
. 18.4. MS PowerPoint

Application
Appl i cation
Word Excel.
:

Acti vate ;
! ;

MS PowerPoint

549

Quit PowerPoint.
.
,
.
Application Visible,

Word Excel.
, Appl i cati on Delphi
TPowerPoi ntAppl i cati on. PowerPoint
Connect .

Presentations
Presentations Application
.
, ,
Documents MS Word Workbooks MS Excel.
,
:

function AddCWithWindow: TOleEnum): _Presentati on .


WithWindow ,
(true) (false). true;
function Open(FileName: WideString; Readonly, Untitled. WithWindow: TOleEnum):
_Presentation . FileName
.
:
Readonly (
true). false;
Untitled ,
. ,
;
Wi thWi ndow , Add;
function ItemCindex: OleVariant): _Presentation
i ndex.

Presentation
Presentation Presentations.
Delphi
TPowerPointPresentation.
Presentations :
var
index: OleVariant:
index:=l:

550

18, ...

PowerPointPresentationl.ConnectTo(
PowerPointApplicationl.Presentations.Item(index)):

ConnectKi nd PowerPoi ntPresentati onl


ckAttachToInterface.
Presentation ,
, Presentati on. :
Col orSchemes Col orSchemes,
;
Fonts Fonts,
( Font), ;
PageSetup PageSetup,
;
SI i des SI i des, ;
SI ideShowSettings SI ideShowSettings,
.
Presentation :
procedure ApplyTemplate(const FileName: WideString)
FileName;
Q procedure Save ;
procedure SaveAs(const Filename: WideString; FileFormat, EmbedFonts: TOleEnum)
/ .
:
Fi I eName ,
Fi I eFormat ,
EmbedFonts , TrueType.
procedure Close .
,
.

Slides
Slides
.
MS Office:
function Adddndex: integer: Layout: TOleEnum): Slide
.
_S1 i de .
. Index
SI ides. Layout ;

function PasteCIndex: integer): SIideRange


SI ides . Index
,
. , ;

MS PowerPoint

551

function Rangedndex: OleVariant): SIideRange SIideRange,


.
Index , .
,
, , .
, ,
. ,
;

function Item( Index: OleVariant): _Slide SI ides


, Index.

Slide
SI i de .
Delphi PowerPointSlide. Slide
, :
Shapes Shapes, ,
;
Background ShapeRange, .
- Background
False FoilowMasterBackground;
ColorScheme ColorScheme,
;
HeadersFooters HeadersFooters, ,
, , ,
;
Name .
N, N ,
;
Master Master, ;
Layout .
SI ide :
procedure Copy ;
procedure Del ete ;
procedure Export(FileName. FilterName: WideString; ScaleWidth. ScaleHeight: integer)
:
Fi I eName ;
Fi 1 terName , ;
ScaleWidth ScaleHeight
;
procedure Select .

19

ActiveX
,
, .

.

OLE Automation ActiveX (
). ,
,
COM, OLE Automation ActiveX Delphi.


COM (Component Object Model)
, .
(Component Objects)
.

Object Pascal.
, .


, .
.
,
, (
).

553

.
.


(
), .
:
(in-process) ,
-
;

,
, -.
.
.
(remote) ,
.


,
.

,
.

, .
.
Windows.
- :
1. ;
2. Windows ,
, -
.
Windows.
, ,
.


.
.
- I ( interface).
, , ,

554

19. ActiveX

I
. , ,
, IDataObject.

. ,
, .
, .

. Windows
(GUID globally unique identifier).
GUID
CLSID (class identifier). GUID
IID (inter
face identifier)..
GUID 16- ,
.

GUID
.
. ,
GUID , , ,
GUID, .

, GUID.
GUID
, : .
,
.
, .

lUnknown
lUnknown.
,
. lUnknown : Querylnterface,
AddRef Release. lUnknown,

. lUnknown
IID,
lUnknown. .

Querylnterface
Querylnterface ,
IID . -

lUnknown

555

, , Querylnterface
NULL. , ,
,
.
. Querylnterface
,
, . ,
,
, .



. ,
, - ISimpleStat.
-.
,
ISimpleStat. ,
, , ,
,
, , , IRegress.
, ISimpleStat, IRegress.
-,
, , ,
ISimpleStat ,
,
.

, IRegress,
, , ,
.
, , IRegress.
,
IRegress
. ,
IRegress NULL.
,
. ,
, , IRegress
, .

556

19. ActiveX



,
.
, .
(,
I Si mpl eStat)
(, ISimpleStat2)
. - ISimpleStat,
ISimpleStat2.
ISi mpl eStat2
. IRegress, ,
, ISi mpl eStat2,
ISimpleStat , .
,
,
. ,
( ).
Querylnterface
, ,
.
,
Querylnterface .

AddRef Release
,
. :
? ,
, ,
. , ,
. ,
,
.

.
, .

, ,
,
. ,
. ,
, .
(reference counting),
lUnknown.

557

.
,
1.

,
, ,
, AddRef .
.
, ,
Rel ease.
1.
, 0.

.
,
, , ,
. -
.


,
, .
,
. ,
.
, -. ,
(, CoCreatelnstance
,
).


,
CoCreatelnstance.
.
(class factory)
, .
,
. , ,

558

19. ActiveX

IC1 assFactory.
:
CoCreatelnstance ,
. IID,
.
CLSID ,
;
LockServer .
,
.
,
.
LockServer.

COM CoGetCl assObject. CLSID
, ( CLSID
!), IID IC1 assFactory.
. , Createlnstance IC1 assFactory,
.

Delphi
, -, Delphi,
. Delphi,
.
Object
Pascal. -
:
.
. -
- ,
Object Pascal
.

TComObj CoClass
Delphi
.
Object Pascal, TComObject
TObject.
Object Pascal, TComObject.
,
.
(CoClass) (
, TestObj CoClass

559

CoTestObj). , - TComObj ,
CoClass
.
,
.

TTypedComObject.
TComObj.

Delphi
Delphi interface.
. ,
IUnknown Delphi :
IUnknown = interface
[' {00000000-0000-0000--000000000046}']
function QuerylnterfaceCconst IID: TGUID: out Obj): integer: s t d c a l l :
function _AddRef: integer: s t d c a l l :
function _Release: integer: s t d c a l l :
end:

,
, .


.
, ,
.

:
1. .
2. .
3. .
4. .
.



, ,
Delphi.
File New Delphi IDE
ActiveX AciveX Library
(. 19.1).

560

19. ActiveX

tim

AcSw*i | Muftittw j fasts j Dafofls ] Prefects | 0a Module* j Business j

0*

ActiveX Control

Object

Automation Object

:-,;<

41

COM Obiect

IS
Property Page

Type Libiaiy

V(,.-

OK

Csneet

. 1 9 . 1 . ActiveX

, ,
TestComServer.pas. :
library TestComServer:
uses
ComServ;
exports
DllGetClassObject.
DIICanUnloadNow.
DllRegisterServer.
DllUnregisterServer;
{$R *.RES}
begin
end.

. ,
( exports),
.



. File New Delphi IDE
ActiveX New Items COM Object
(. . 19.1).
New Items
(. 19.2). COM Object Wizard
:
Class Name;

561


Instancing. :
Internal ;
Single Instance
;
Multiple Instance
;

Threading Model, :
Single ;
Apartment ,
.
;
Free
;
Both Apartment Free.
, ,
Implemented Interfaces;
Description;
Include Type Library ,
;
Mark interface Oleautomation
OLE Automation.
COM UbiectWizald
CtewName:

JTestCom

Instance^

[Multiple Instance

Jhteadiijs Mofef

] S ingle

:;.;.;:-:-

F";:"

d
zi

)esQflpbon

' P Include Tjipybre>

f " Mkvtfflfcefifea*wato

OK

Cancel

. 19.2.

:
TestCom;
Multiple Instance;
Single.

562

19. ActiveX

, , (
Include Type Library) OLE Automation.
, TestCom,
(. 19.3).

:
unit TestCOM:
interface
uses
Windows. ActiveX, Classes. ComObj, TestComServerJIB. StdVcl;
type
TTestCom = class(TTypedComObject, ITestCom)
protected
{Declare ITestCom methods here}
end;
implementation
uses ComServ:
initialization
TTypedComObjectFactory,Create(ComServer. TTestCom. Class_TestCom.
ciMultiInstance. tmSingle);
end.


IDL (Interface
Description Language ).
C++. Delphi
Object Pascal.
Delphi, ,
, ,
.
Delphi
.

, Delphi Object Pascal,


IDL.

. 19.3.
,
.

563

,
. ,
( ).
, ,

.

QUiU:

JI05084EE0 534-11D4 81 -0060520799 )

Version!

fTo

loo-

~"

"

'

5 1$$

JTestComServer Library

i HsIpConf**

HdpSirmFjDLt:

j^ ^

. 19.3.


. .
,
, :

New Interface ;
New Dispinterface ;
New CoClass CoClass ;
New Enum ;
New Alias ;
New Record ( ,
);
New Union ( );
New Module .
,
:
New Method , ;
New Property .

564

19. ActiveX

-
-.
,
:
Refresh , ,
;
Register .
, , Export To IDL,
IDL.

.
,
, .
Include Type Library

.
CoClass (
, ):
unit TestComServerJIB:
{$TYPEDADDRESS OFF}
interface
uses Windows. ActiveX, Classes, Graphics. OleServer, OleCtrls. StdVCL:
const
TestComServerMajorVersion = 1;
TestComServerMinorVersion = 0:
LIBIDJestComServer: TGUID = ' {05084EE0-A534-11D4-A8C10060520799BE}':
IIDJTestCom: TGUID = ' {05084EE1-A534-11D4-A8C10060520799BE}':
CLASSJestCom: TGUID = ' {05084EE3-A534-11D4-A8C10060520799BE}' :
type

ITestCom = interface:
TestCom = ITestCom;
ITestCom = interface(IUnknown)
['{05084EE1-A534-11D4-A8C1-0060520799BE}']
end;
CoTestCom = class
class function Create; ITestCom;

565

class function CreateRemote(const MachineName:


s t r i n g ) : ITestCom;

end;
implementation
uses ComObj;

class function CoTestCom.Create: ITestCom:


begin
Result := CreateComObject(CLASS_TestCom) as ITestCom:
end:
class function CoTestCom.CreateRemote(const MachineName:
string): ITestCom;
begin
Result := CreateRemoteComObject(MachineName,
CLASSJIestCom) as ITestCom;
end:

end.
CoTestCom :
Create ;

CreateRemote
.
ITestCOM.

.
.
, , .
,
. ,
. :

;
. ,
.
ITestCom, .
:
1. New Interface
. ,
.
2. . ,
(
Interface].). ,
Name Attributes (
).
IMi nMax.

566

19. ActiveX

Attributes
.
:

GUID ,
. ;
Version ;

Parent Interface
. IUnknown.
Flags
.
- .

. ,
:
1. .
2. New Method .
3. .
.
.
.
Attributes Parameters.
, Attributes, .
Name.
Parameters , (
), ,
( ).
Return Type (. 19.4).
,
Parameters. Add
.
(. 19.5):

Name ;

;
Modifier :
, . .
.
.
ITestCom Avg (
) Variance ( ). IMinMax
Mi n ( ) (
).

567

.|J * ' i J] #
> TeslComSeiver

nbutet

ITeslCom
*
& Dispettion
TestCom

1 * j Flags

e t u n Type. Heal

Zl

DISPPARAMS

$ IMinMax

EXCEPINFO
float
FontFONTBOLD
FontE vents"
FONTITALIC

{Name

Moveftowrt |

MoveUf.

'Modftd

. 19.4. ,

TestComServef

Mr b^e*

^ > ITestCorn
^ Avg
< Disoeition
j ^

TestCom

j *

IMmMax

Pawmeters J Flags j 7 *

Zl

etyrn Type {''oat


hamsters
Name
Paiaml

'-

'

'

J Type

eWe

..

Msolfei

VARIANT
unsigned char
unsigned int
unsigned long
unsigned shoit
VARIANT
VARIANT"
VARIANT BOOL

" '

.
*

j Mo v e U p

Move Sewn j

. .

. 19.5.

, , .
Return Type float.
,
. ,
, .
. -

568

19. ActiveX

Variant.
.

.
CoClass (
, TestCom). Implements
Insert Interface
( IMinMax).

. Refresh
.
,
:
unit TestComServer_TLB;
{STYPEDAODRESS OFF}
interface
uses Windows. ActiveX, Classes. Graphics. OleServer,
OleCtrls, StdVCL;
const
TestComServerMajorVersion = 1:
TestComServerMinorVersion = 0;
tIBID_TestComServer: TGUID = '{05084EEO-A534-11D4A8C1-0060519799BE}';
IIDJTestCom: TGUID = '{05084EE1-A534-11D4-A8C10060519799BE}':
IIDJMinMax: TGUID = '{1AD49219-A5FB-11D4-A8C10060519799BE}':
CLASSJestCom: TGUID = ' {05084EE3-A534-11D4-A8C10060519799BE}';
type
ITestCorn = interface:
IMinMax = interface:
TestCom = ITestCorn:
ITestCorn = interface(IUnknown)
['{05084EE1-A534-11D4-A8C1-0060520799BE}']
function Avg(Paraml: OleVariant): Single: stdcall;
function Variance(Paraml: OleVariant): Single;
stdcall;
end:
IMinMax = interface(IUnknown)
['{1AD49220-A5FB-11D4-A8C1-0060520799BE}']

569

function MinCParaml: OleVariant): Single: stdcall;


function Max(Paraml: OleVariant): Single: stdcall:
end:
CoTestCom = class
class function Create: ITestCom:
class function CreateRemote(const MachineName:
string): ITestCom:
end:
implementation
uses ComObj:
class function CoTestCom.Create: ITestCom:
begin
Result := CreateComObject(CLASS_TestCom) as ITestCom:
end;
class function CoTestCom.CreateRemote(const MachineName: string): ITestCom:
begin
Result := CreateRemoteComObjecUMachineName.
CLASS_TestCom) as ITestCom:
end;
end.
,

. ,
.
Refresh
(
TestComServer_TLB.pas), :
unit TestCOM;
interface
uses
Windows, ActiveX, Classes, ComObj, TestComServerJIB,
StdVcl;
type
TTestCom = class(TTypedComObject. ITestCom, IMinMax)
protected
function AvgCParaml: OleVariant): Single: stdcall;
function VariancetParaml: OleVariant): Single;
stdcall;
function Max(Paraml: OleVariant): Single; stdcall;
function MintParaml: OleVariant): Single; stdcall;
{Declare ITestCom methods here}
end;

implementation
uses ComServ;

570

19, ActiveX

function TTestCom.AvgCParaml: OleVariant): Single;


begin
end;
function TTestCom.Variance(Paraml: OleVariant); Single:
begin
end:
function TTestCom.Max(Paraml: OleVariant): Single;
begin
end;
function TTestCom.Min(Paraml: OleVariant): Single:
begin
end;
initialization
TTypedComObjectFactory.CreateCComServer. TTestCom,
Class_TestCom,ciMultiInstance, tmSingle):
end.

TTestCom
. , Impl ementati on
,
.

TTestCom
. .
, ITestCom IMinMax.


.

begin end .
.

.
Variant.
.
:
function VarArrayCreate(const Bounds: array of Integer; varType: Integer): Variant
. Bounds , varType
;

571

function VarArrayOf( const Values: array of Variant): Variant



, Values.

. :
function VarArrayLowBouncKconst A: Variant: Dim: Integer): Integer
Dim ;
function VarArrayHighBoundCconst A: Variant; Dim: Integer): Integer
Dim .

,
. VarArrayLowBound
VarArrayLowBound ,
.

1. ,
Dim
1.
,
, :
,
:
function TTestCom.Avg(Paraml: OleVariant): Single:
var
N1.N2.1 : Integer;
A : Single:
begin
A:=0;
Nl:=varArrayLowBound(Paraml.l);
N2:=varArrayHighBound(Paraml,l):
for i:=N1 to N2 do
A:=A+Paraml[i]:
resu1t:=A/(N2-Nl+l):
end;
function TTestCom.Variance(Paraml: OleVariant): Single:
var
Nl,N2.i : Integer;
A.D : Single:
begin
A:=Avg(Paraml);
D:=0:
N1:=varArraytowBound(Paraml.1);
N2:=va rArrayHi ghBound(Pa rami.1):
for i:=Nl to N2 do
D:=sqr(Paraml[i]-A):
result:=D/(N2-Nl);

572

19. ActiveX

end;
function TTestCom.MaxCParaml: 01eVariant): Single;
var
N1.N2.1 : Integer;

M : Single;
begin
Nl:=varArrayLowBound(Paraml,l);
N2:=varArrayHighBound(Paraml.l);
M:=Paraml[Nl]:
for i:=Nl to N2 do
i f Paraml[i]>M then M:=Paraml[i];
result:=M:
end;
function TTestCom.MirKParaml: OleVariant): Single;
var
Nl.N2.i : Integer;

M : Single;
begin
N1:=varArrayLowBound(Pa rami.1);
N2:=varArrayHighBound(Paraml,1);
M:=Paraml[Nl];
for i:=N1 to N2 do
i f Paraml[i]<M then M:=Paraml[i];
result:=M;
end;

.

.
, ,
.
Project Compile
Ctrl+F9. ,
TestCOMServer.dlL.
,
.
:
Delphi Run Register ActiveX Server ;
RegSvr32;
;
, ,
, Dl I Regi sterServer,
.
.
, ,
, .
-, ,
.

573



,
, . ,
, -.
.
-
. File New
Application Delphi IDE.
. :

, .
.
: [1, 2, 3, 4, 5, 6, 7, 8, 9].
( TListBox);
,
, .
(TButton), TLabel.
, ,
, .
TGroupBox. . 19.6.
I f

- "
'.; : Unknown |

"PSHWUM IMinM*
: Unknown

; Unknown j : Unknown

I
|

. 19.6.

.
, uses
( TestComServer_TLB).

Object Pascal
. -
( )
. Object Pascal
Delphi. Project Import Type Library.
,
ActiveX.
Install.

574

19. ActiveX

,
,
. private
pub! ic :
TForml = class(TForm)

private
Stat: ITestCom;
MinMax : IMinMax;
public
end:


.
- OnShow .
,
.
Create
(CoClass) .
( ITestCom).
- Querylnterface
. OnShow,
,
:
procedure TForml.FormShow(Sender: TObject);
begin
Stat:-CoTestCom.Create:
Stat.QueryInterface(IMinMax,MinMax):
end:

- OnCI ick ,
.

Delphi.
:
unit Clientllnit:
interface
uses
Windows, Messages. SysUtils. Classes. Graphics.
Controls, Forms. Dialogs. TestComServer_TtB.
StdCtrls. ExtCtrls:

type
TForml = class(TForm)
ListBoxl: TListBox:
Panel 1: TPanel:
GroupBoxl: TGroupBox:
Buttonl: TButton:
Label 1: TLabel:


Label 2: TLabel:
Label3: TLabel;
Label4: TLabel:
GroupBox2: TGroupBox:
Label5: TLabel:
Label6: TLabel;
Label7: TLabel:
Label8: TLabel;
Button2: TButton:
procedure FormShow(Sender: TObject):
procedure ButtonlClick(Sender: TObject):
procedure Button2Click{Sender: TObject);
private
/ / -
Stat: ITestCom;
MinMax : IMinMax:
public
{ Public declarations }
end;
var
Forml; TForral;
implementation
{$R *.DFM}

procedure TForml.FormShow(Sender: TObject);


begin
// COM
// ITestCom
Stat:=CoTestCom.Create;
// IMinMax
Stat.QueryInterface(IMi nMax,Mi nMax):
end;
procedure TForml.ButtonlClick(Sender: TObject):
var
V: OleVariant:
i: Integer;
begin
//
V;=varArrayCreate([0.
ListBoxl.Items.Count-l].varSingle):
//
for i:=0 to ListBoxl.Items.Count-1 do
V[i]:=StrToFloat(ListBoxl.Items[i]);
// ITestCom
//
L abel3.Captlon:=F1oatToStrF(Stat.Avg(V),ffGenera1.4.2);
Label4.Caption:=FloatToStrF(Stat.Variance(V).
ffGeneral.2.2);
end:
procedure TForml.Button2Click(Sender: TObject):
var

575

576

19. ActiveX

V: 01eVariant:
i: Integer;
begin
//
V:=varArrayCreate([0.
ListBoxl.Items.Count-1].varSingle);
// tistBoxl
for i:=0 to ListBoxl.Items.Count-1 do
V[i]:=StrToFloat(UstBoxl.Items[1]);
// IMinMax
//
Label7.Caption:=FloatToStrF(MinMax.Min(V),
ffGeneral.4.2);
Label 8.Caption:=FloatToStrF(MinMax.Max(V).
ffGeneral.2.2);
end:
end.


(OLE Automation)
. ,
.
Windows,
. OLE
Automation ,
.
,
.

, ,
.
,
, (dispinterface).
,
.


,
.
(in-process) (outprocess). ,
.
,
.
.

IDispatch

577

, ,
DLL- . , DLL-
, -.
,
.
.


,
.

.
.


tlb (Type Library)
olb (Object Library). :

;
;
;
.

.
,
,
.

IDispatch
( ) IDi spatch
,
IUnknown.
.
Invoke.
, ,
Invoke.
, (dispid).
case:
, .

IDispatch.
Invoke .

578

19. ActiveX

Delphi
Delphi .

, .
Delphi TAutoObject,
TTypedCOMObject.
.
, ,
.
.


Delphi
:
1. -.
2. .
3. ,
.
4. .
, ,
.

-
- ,
.
. , File New Application
Delphi IDE.


- ,
. File New,
New Items ActiveX Automation
Object (. . 19.1).
New Items
, (. 19.7)
.
Automation Object Wizard :

CoClass Name (
TestAuto);

579

Delphi
tUlllillTxj

I Automation. Object. ; ! -

CtsQasstaK

(TestAuto

IrtStanWtg'

] Multiple Instance

IhtfadiiJfHbdet

(Apartment

*];

OaHara

* G*eraivnUwiortco<)
OK

CmsxA

. 19.7.

Instancing .
;
Threading Model .
-;
Generate Event support code ,
.
Automation Object Wizard
.
( AutoObjectUni t),
, ,
:
unit AutoObjectUnit:
interface
uses
ComObj. ActiveX. AutoServerJIB. StdVcl;
type
TTestAuto = classtTAutoObject. ITestAuto)
protected
{ Protected declarations }
end;
implementation
uses ComServ;
initialization
TAutoObjectFactory.Create(ComServer. TTestAuto,
Class_TestAuto.ciMultiInstance, tmApartment):
end.


.
. ,
, .

580

19. ActiveX

,
, :
unit AutoServer_TLB;
{STYPEDADDRESS OFF}
uses Windows. ActiveX. Classes, Graphics. OleServer,
OleCtrls. StdVCL;
const
AutoServerMajorVersion = 1;
AutoServerMinorVersion = 0;
LIBID_AutoServer: TGUID = '{62D7BF80-A76C-11D4-A8C10060520799BE}' ;
IIDJTestAuto: TGUID = '{62D7BF81-A76C-11D4-A8C10060520799BE}' :
CLASS_TestAuto: TGUID = '{62D7BF85-A76C-11D4-A8C10060520799BE}':
type
ITestAuto = interface;
ITestAutoDisp = dispinterface;
TestAuto = ITestAuto;
ITestAuto = interface(IDispatch)
['{62D7BF81-A76C-11D4-A8C1-0060520799BE}']
end;
ITestAutoDisp = dispinterface
['{62D7BF81-A76C-11D4-A8C1-0060520799BE}']
end;
CoTestAuto = class
class function Create: ITestAuto;
class function CreateRemotetconst MachineName:
string): ITestAuto;
end;
implementation
uses ComObj;
class function CoTestAuto.Create: ITestAuto;
begin
Result := CreateComObject(CLASS_TestAuto) as ITestAuto;
end;
class function CoTestAuto.CreateRemote(const MachineName: string): ITestAuto;
begin
Result := CreateRemoteComObjecttMachineName. CLASS JlestAuto) as ITestAuto:
end;
end.

Delphi

581

ITestAuto
TTestAuto.

IDispatch
(
), ,
.

ITestAutoDisp
.

,
.
,
. ,
,
, , ,
HRESULT. ,

.
,
: ,
.
,
. HRESULT
, Return Type .

, .
, ,
.
, out. ,
, *
Parameters (. 19.8).
out ( ,
), Modifier Parameters.
(. . 19.8).
Parameter Flags (. 19.9),
.
Out.

, . 19.8.

582

19. ActiveX

' i fl IHnillll '

;;

& AuioServet
-I j * ITestAuto
Jh Avg

Aifobutfe* F-e'tfftefsra | Ffjs^ | Text


fitwil

HRESULT

4fr ITestAutoE vents


TestAuto

If?

Name

IMgdfltet

Patarnl

VARIANT

Paiam2

float

|in)

:1!]....

)eteta

1
isi

W<3v*Up I Move Dawn j

Mtxffl*d

. 19.8.
1 Paiametei 9 0 ^ 1 1 | 1 | 1 1 1 1

1*

12

fit*

OfiSena!

as e t Value
f . c ' s - < ' , -.

!
(

Caned

. 19.9. Parameter Flags


Refresh .
:
unit AutoServer_TLB;
{STYPEDADDRESS OFF}
uses Windows. ActiveX. Classes, Graphics. OleServer.
OleCtrls. StdVCL:
const
AutoServerMajorVersion = 1;
AutoServerMinorVersion = 0;
LIBID_AutoServer: TGUID = '{62D7BF80-A76C-11D4-A8C10060520799BE}';
IIDJTestAuto: TGUID = ' {62D7BF81-A76C-11D4-A8C1-

Delphi
0060520799}'
CLASS_TestAuto
0060520799}'

583

TGUID = {62D7BF85-A76C-11D4-A8C1-

type
ITestAuto = interface;
ITestAutoDisp = dispinterface;
TestAuto = ITestAuto:
ITestAuto = interface(IDispatch)
[' {62D7BF81-A76C-11D4-A8C1-0060520799BE}']
procedure Avg(Paraml: OleVariant;
out Param2: Single): safecall:
procedure Dispersion(Paraml: OleVariant:
out Param2: Single): safecall;
end:
ITestAutoDisp - dispinterface
['{62D7BF81-A76C-11D4-A8C1-0060520799BE}' ]
procedure Avg(ParamI: OleVariant;
out Param2: Single); dispid 1;
procedure Dispersion(Paraml: OleVariant:
out Param2: Single); dispid 2;
end;
CoTestAuto = class
class function Create: ITestAuto:
class function CreateRemotetconst MachineName:
string): ITestAuto:
end;
implementation
uses ComObj;
class function CoTestAuto.Create: ITestAuto:
begin
Result := CreateComObject(CLASS_TestAuto) as ITestAuto;
end;
class function CoTestAuto.CreateRemotetconst MachineName:
string): ITestAuto:
begin
Result := CreateRemoteComObject(MachineName.
CLASS_TestAuto) as ITestAuto:
end;

end.
,
dispid, .
,
Invoke.
TTestAuto.
,

584

19. ActiveX

,
.
, (
) .
, ,
:
unit AutoObjectUnit;
Interface
uses
ComObj. ActiveX. AutoServerJIB. StdVcl:
type
TTestAuto = classCTAutoObject, ITestAuto)
protected
{ Protected declarations }
procedure Avg(Paraml: OleVariant;
out Param2: Single); safecall;
procedure DispersiontParaml: OleVariant;
out Param2: Single): safecall;
end;
implementation
uses ComServ;
procedure TTestAuto.Avg(Paraml: OleVariant:
out Param2: Single);
var
Nl.N2.i ; Integer;
A : Single;
begin
A:=0:

Nl;=varArrayLowBound(Paraml.l);
N2:=varArrayHighBound(Paraml.l);
for i:=N1 to N2 do
A:=A+Paraml[i];
Param2:=A/(N2-Nl+l)
end:
procedure TTestAuto.Dispersion(Paraml: OleVariant:
out Param2: Single):
var
N1.N2.1 : Integer:
A.D : Single;
begin
Avg(Paraml.A):
D:=0;

Nl:=varArrayLowBound(Paraml,l);
N2:=varArrayHighBound(Paraml.l);
for i:=Nl to N2 do
D:=sqr(Paraml[i]-A);
Param2:=D/(N2-Nl);
end:

ActiveX

585

initialization
TAutoObjectFactory.Create(ComServer, TTestAuto,
Class_TestAuto, ciMultiInstance. tmApartment):
end.

.
.

-.



. ,
MS Office.


Create01e0bject(const ClassName: string): IDispatch.
,
( , ,
: ' AutoServer. TestAuto').
OleVariant.
, ,
01 eVariant CreatedeObject:
var
S: OleVariant;

S:=Create01eObject('AutoServer.TestAuto'):

ObjectPascal:
S.Methodl(Paraml.Param2):
,
, .
.
-.

ActiveX
ActiveX OLE
OCX. Microsoft OCX,
,
- (, ActiveX
web- web-
).
, OLE ActiveX.

586

19. ActiveX

ActiveX
, Automation. ,
ActiveX, , Web
Microsoft, OLE .
ActiveX , .
ActiveX
Microsoft ,
OLE (OLE Automation, OLE Documents, OLE Controls . .).
OLE ActiveX
ActiveX OLE,
. ActiveX
OLE
.
OLE ActiveX.

ActiveX
ActiveX ,
, ,

.
,
. ,
.
. ActiveX

.
.
(
)
. :

, ;
,
;
,
, ;

;
,
;
;
,
, .

ActiveX Delphi

587

ActiveX

Windows.
ActiveX
(Visual Basic, Visual C++, Borland Delphi, Borland C++ Builder,
Java).

, ActiveX
,
:
1. ActiveX Windows.
, ,
Windows .
,
, Windows
.
2. ActiveX -
. ActiveX ( )
, , .
, ,
(, , MS Office,
).


ActiveX Delphi
Delphi ActiveX
, VCL. Delphi
ActiveX, ActiveX
. , , ActiveX
VCL ,
.

ActiveX
ActiveX,
.
, , .
-
,
, -
, . ( VCL ActiveX,
, ,
.)

588

19. ActiveX

Delphi ActiveX.
ActiveX pdf.ocx,
Adobe Acrobat Reader.
ActiveX :
1. .
2. Delphi IDE.
ActiveX , , .
ActiveX
, Import ActiveX (. 19.10),
Component Import ActiveX Control.
pdf.ocx Import ActiveX,
.

l#iptAAtAv&( |

Active Setup Control Library (Version 1 0)


bl549 OLE Control module (Version 1 0)
DHTML Edit Control for IE5 (Version 1 0)
DirectAnirnalion Library (Version 1 0)
EYEDOG OLE Control module (Version 1 0)
HHCtrl 4 0 Type Library (Version 4 0]

Zl

dAwinepfrAAcwbal 4 DAReadw'AajwiS'iprff ew

Add.

j j
PateSPB; |ActiveX
Lfntfjifname jd\winapps\borfand^Delpfn5\lniports\

,., j

geatchpa'h.

, J

j$(OELPHI]\Lib.$(DELPHI|\Bin$(DELPHII\!mpor

JftStalL

Cal*tSn*

Cancel

. 19.10. Import ActiveX

ActiveX,
Import ActiveX
. Windows, Microsoft Office
(, Adobe Acrobat Reader).

, ,
, ,
. ActiveX Import
ActiveX. Add
. ,
, ActiveX, .

ActiveX Delphi

589

ActiveX , dll.

Import ActiveX ActiveX,


Class Name , .
, pdf.ocx , TPdf.
Class Name . , -
, .
Install .
Install (. 19.11),
, .
.
Install Into new package File name
. pdf.dpk. Description
Install .

MowtinBpaskese

SfltanswoMskag*!

- -filename:

JD \WinApp5\Boilatid\DelpN5\lib\pdf dpk

lit**...

| i

j>e$cnptiDr<c jViewei for PDF files

... .
1

Cew&A

a*

. 1 9 . 1 1 .

Install
Object Pascal.
ActiveX,
_TLB. pas.
ActiveX,
, Delphi IDE
ActiveX. Pdf.
ActiveX
VCL.

ActiveX
ActiveForm
ActiveX Delphi VCL
. ActiveForm
.

VCL ActiveX
ActiveX
VCL ActiveX. , -

590

19. ActiveX

- ActiveX,
VCL, ActiveX.

ActiveX VCL,
TWinControl. ActiveX
VCL,
. , -,
. -,
,
.

VCL ActiveX .
,
ActiveX Control ActiveX New Items. (,
File New Delphi IDE.)
ActiveX Control Wizard (. 19.12)
:
VCL, ActiveX,
VCL Class Name;
ActiveX New ActiveX Name;
Implementation Unit;
Project Name;

Threading Model;
ActiveX Control Options:
Include Design-Time License ActiveX
;
Include Version Information ;
Include About Box .
ActiveX Control Wizard
VCL Pass Name.

JTE*

M w ActiveX ms JEdiiX
hRpteRWrtatianLjntt;

jEditlmpH pas

giojeetName:

lEditXConltoH dpr

XfifsgdipgModef;

| Apartment

AdweX Con W Option*

" Muds 4 Box


" iiw*idex*ia<>rtinfciifflatft
Canee!

. 19.12. ActiveX

ActiveX Delphi

591


: ( ActiveX
,
), .
ActiveX .

Active Form
ActiveX VCL,
.
. , ActiveForm
.
, ActiveForm,
. , , ,
, ,
. ,
,
.
ActiveForm. ActiveForm
.
sales.mdb
( , , ,
,
ActiveForm).
:
1. File New New Items
ActiveX ActiveForm.
.
2. ActiveForm
ActiveForm Wizard.
ActiveX, . 19.12.
, ActiveForm
VCL, ActiveX, VCL Class
Name ActiveForm Wizard .
ActiveForm .
3. ActiveForm Wizard
, : TableProjl.dpr ,
DLL; Tablelmpll.pas ,
ActiveForm; TableProjl_TLB.pas
Object Pascal. , , ,
ActiveForm.
4. : TADOTable, TDataSource TDBGrid,
ADOTabl el, DataSourcel DBGridl
. ADOTabl el -

592

19. ActiveX

sales.mdb. DataSet DataSourcel


ADOTablel, DataSource DBGridl DataSourcel (
, DBGridl
).
5. ,
, ActiveForm. . :
ActiveDb,
(
true , false
). ,
Act i ve ADOTabl el
(, ,
ActiveForm, , ,
).
6. ,
ITableX
, New Property .
Read Write.
ActiveDb.
, (. 19.13).
VARIANT_B00L.

##*#**$$
* Active

^ - ' j j j - a ]
paiaseiasj Ftees

DropTaiget
* Drop Target

] ActiveDb

* j HelpFiie
*J> HelpFiie

I"

9t

*Jd DoubleBuflered
* DoubleBurfered

JVARWJT_B00L

* $ VisibleDockQenlCoui
*tj

i"

Enabled

y * Enabled

Tes*

zi
J

-- -

* J j Cut soi

% j * Cuisor
* ^ Family

i Context

! 5*;1 j
* ActiveDb
i - ITableXEvents
&

TableX
TxActiveFoimBorderStyle
TxPrinrScale
TxMouseBuHon

<L
\<4
.

1 9 . 1 3 . ActiveForm

7. Refresh Implementation .
, ,

ActiveX Delphi

593

: ITableX
ActiveDb : Get_ActiveDb Set_ActiveDb
.
( ).
:
function TTableX.Get_ActiveDb: WordBool;
begin
result:=AD0Tablel.Acti ve;
end;
procedure TTableX.Set_ActiveDb(Value: WordBool);
begin
ADOTablel.Active:=Value;
end:

8. ,
ADOTabl el ,
ActiveForm. ,
.
ITableX,
Fami ly. ,
, .
, Acti veDb,
New Property Read Only.
BSTR ( Wi deString
Object Pascal).
9. Refresh Implementation ,

Get_Fami 1 :
function TTableX.Get_Family: WideString:
begin
result:=AD0Tablel.FieldByName('').AsString;
end;

10. , ,
AfterScrol 1 ADOTabl el, ActiveForm.
,

.
ITableXEvents. ,
,
OnScrol 1.
Refresh Implementation
.
. , ,
, ItableXEvents, TNotifyEvent.
AfterScrol 1 TADOTabl e
TDataSetNotifyEvent.
, :

594

19. ActiveX

TTableX = class(TOleControl)
private
FOnScroll: TDataSetNotlfyEvent:
public
property OnScroll: TDataSetNotifyEvent read FOnScroll
write FOnScroll:
end:
, uses
Db, TDataSetNoti fyEvent:
uses

Windows. ActiveX, Classes, Graphics. OleServer,


OleCtrls. StdVCL. Db;
11.


ActiveForm. pri vate
, -
AfterScroll TADOTable.
, ,
. Scrol I Event:
TTableX = classCTActiveForm, ITableX)
DataSourcel: TDataSource:
ADOTablel: TADOTable;
DBGridl; TDBGrid:
private
{ Private declarations }
FEvents: ITableXEvents;
procedure ScrollEventtDataSet: TDataSet);
protected
{ Protected declarations }
function Get_ActiveDb: WordBool; safecall;
procedure Set_ActiveDb(Value: WordBool): safecall:
public
{ Public declarations }
procedure Initialize: override;
end:

12. Initial ize:


procedure TTableX.Initialize;
begin
inherited Initialize:
OnActivate := ActivateEvent:
OnClick := ClickEvent;
OnCreate := CreateEvent;
OnDblClick := DblClickEvent;
OnDeactivate := DeactivateEvent;
OnDestroy := DestroyEvent:
OnKeyPress := KeyPressEvent;
OnPaint := PaintEvent:

ActiveX Delphi

595

ADOTablel.AfterScroll := ScrollEvent:
end:

.
ActiveForm.
AfterScrol 1 ADOTabl el
Scrol I Event.
13. , , Scrol 1 Event:
procedure TTableX.ScrolTEventCDataSet: TDataSet):
begin
i f FEvents <> n i l then FEvents.OnScroll:
end;

.
( TableProjl.ocx).
,
,
, .

Delphi IDE.
ActiveX,
. ActiveForm
Delphi . ,
Delphi,
, ActiveX (,
Visual Basic).

20


, web-
.



,
.

IP

. ARPANET,
.
,
. ARPANET
- -.
,
.
IP (Internet Protocol).

,
, IP-
, IP.

,
.

597

- ,
-
.
IP,
(
),
.

IP ,
: , IP,
.
,
-1-.
.


.
,
. ,
, ,
() .

. ,
- (, . .),
,
.
,
, , ,
.
, .

. ,
:
;
;
;
.
,

.
.

598

20. -


.
.
, ,
, .

.
:
MAC (Medium Access Control) ;
LLC (Logical Link Control) ().
MAC ( Token Ring
Ethernet)
. LLC, MAC,
, .


,
. ( )
,
. Ethernet, Token Ring,
. . ,
() .
. ,
,
.

(
),
, .
(
) ICMP
(Internet Control Message Protocol), RIP (Routing Internet Protocol) OSPF (Open
Shortest Path First). , ,
.
IP.
, IP, ,
, . IP- .
, 127.0.0.1.
, , .
, -

599

.
IP-
(, Ethernet
Ethernet- IP- , ,
ARP).
, IP, .
1 1500 .


.
TCP (Transmission
Control Protocol). TCP
, IP. TCP
, , ,
.
TCP-,
IP-, .
(TCP-) IP- TCP-,
. -
, TCP .
.
-
, . TCP .
, .
,
( ).
TCP- , -. ,
, ,
.
, TCP ,

.

, TCP IP.
TCP/IP. TCP/IP ,
TCP IP. ,
.



. ,

600

20, -

. ,
:
HTTP (Hypertext Transfer
Protocol);
G FTP (File Transfer Protocol);
SMTP (Simple Mail Transfer
Protocol) P O P (Post Office Protocol).
,
.


, IP-
, .
IP-,
.
.
IP-.



(Domain Name System), .
.
, :
domainji

domain_2.domain_l

() ,
. ( ) , ,
. : ( SU), us,
de, uk . .
,

, .
:

com ;
edu ;
gov ;
int ;
mi 1 ;

net ;
org .

601

, ,
. ,
, .

InterNIC. Whols
IP-.

IP-. DNS- , ,
. DNS-
, ,
. DNS- IP-,
.
DNS-.


IP- ,
. ,
, , ,
. .
. ,
HTTP, FTP,
SMTP, POP3, . .
,
0 65534.
. , FTP 21, HTTP 80, SMTP 25,
110. ,

. , ,
web.

, .


(Uniform Resource Locator, URL)
, . .
URL :
[]://[][:]@[][:][//]
[][? ]
:

,
(, ftp, http . .);
;

602

20. -


, ;
;
. ,
;

;
;

.

URL .
.

web-
,
web-.
web-
.


W W W (World
Wide Web) ,
.
, ,
. ,
web- (web-), HTTP.

web- ,
:
1. , .
2. ,
, . web-
, HTTP.
3. , web-
. ,
web-, WWW-.

( web) , .

web-

603

: Microsoft Internet
Explorer Netscape Navigator. -
(HTML) HTML-
.
web-
:

,

;
,
HTML- (, ,
). HTML-
,
( web-
). , ,
(, ),
HTML- ,
, , . ,
, ,
. ,
,
, .

Web- web-
web-
:
web-, , ,
web-,
web- . .;

web-:
web-,
, , ,
,
;

web- World Wide Web.


, , web-,
:

web-, web. web-
, , , web-.
HTML-
(, Microsoft FrontPage);

604

20. -

web- HTML
Java, JavaScript, VBScript,
, HTML.

,
web-, .

.
;

.
,
Windows,
.
Delphi Visual Basic (
Windows web).

web- web web-. .


web- web-
HTML. HTML- Java
web-. web-
web-.

web-
, .

HTTP
, W W W ,
HTTP (, ). ,
web-,
.
,
.
HTTP MIME (Multipurpose Internet
Mail Extension). MIME,
:
<>/<>
, (,
, , . .), .
HTTP
:

HTTP

605

TCP-;
;
;
-.
HTML-
- . .


:
Q ;
;
;
.
:
< > <URL pecypca> < >
:
, URL.
: GET POST:
GET URL-
. GET
.
;
POST .
POST -,
;
:
/<>
, HTTP 1.0 :
HTTP/1.0

.
:
< >: <>
:
Host IP- , ;
From ;
Accept MIME- , .
, . ,
, ;
Accept-Language , ,
. ;

606

20. -

Accept-Chanset ,
. ;

Content-Type MIME- , ;
Content-Length , ;
Connection TCP-.
C l o s e , .
Keep-Alive,
;

User-Agent .
.
, ,
.
:
GET http://www.altavista.com HTTP/1.0
Connection: Keep-Alive
User-Agent: Mozilla/4.04 [en] CWin95; I)
Host: www.altavista.com
Accept: image/git. image/jpeg, image/png. */*
Accept-Language: en. ru
Accept-Charset: IS08859-1, Winl251. *


web-
, .
( , , web-),
.

:
;

;
;
.

:
< > < > <>
:

, ;
,
;
.
,
.

607

HTTP

. ,
, :
1 . ,
. ;
2 ;
3 ;
4 ;
5 .
. 20.1.
2 0 . 1 .

100

Continue

200

OK

201

Created

202

Accepted

301

Multiple Choice

302

Moved Permanently

400

Bad Request

403

Forbidden

404

Not Found

405

Method Not Allowed

500

Internal Server Error

501

Not Implemented

503

Service Unavailable

505

HTTP Version not


Supported

HTTP

,
. ;
Server web-;
Al low , ;
Content-Language ,
;

Content-Type MIME- , ;

608

20. -

Content-Length , ;
Last-Modified ;
Date ;
Expi res , , ,
, ;
Locati on .
;
Cache-Control .
.
HTML- .
Content-type.
, HTML-
:
HTTP/1.1 200 OK

Date: Sat. 11 Nov 2000 14:23:07 GMT


Server: Apache/1.3.6 (Unix) PHP/3.0.7 rus/PL28.12
Connection: close
Content-Type: text/html: charset=windows-1251
Expires: Thu. 01 Jan 1970 00:00:01 GMT
Last-Modified: Sat, 11 Nov 2000 14:24:44 GMT
Vary: accept-charset. user-agent
<html>
<head>
<meta name="author" content="WEBLab">
<title>Novgorod On-Line.
.</title>
</head>
<STYLE TYPE="text/css"><!-A {text-decoration: none}
--></STYLE>

,
telnet.exe, Widows.
, (
web- 80).
. ,
.

HTML
HTML- web-,
web- . ,
, , HTML-.
web-
(HTML).

HTML

609


HTML ( ).
,
HTML-.

HTML-
HTML- ,
,
. HTML-
.

HTML- ,
. HTML-
.
JPEG, GIF PNG.

,
. < >.
:
< []>
:
</ >
HTML <>
</HTML>. :
( HEAD);
,
BODY.
HTML :
<HTML>
<HEAD>

</HEAD>
<B0DY>

</B0DY>
</HTML>


(,
, ),
. :
<11> HTML-,
;
<BASE> , URL-
( );

610

20. -

<LINK> , HTML-;
<> HTML-.


TITLE.


<B0DY> </B0DY>
, .

BODY FRAMESET,
HTML- ( ).
HTML-.

,
, .


,
.

HTML- .
:
<1> </1>
<2> </2>

<> </6>
ALIGN,
.
:
LEFT ;
RIGHT ;
CENTER .
, , ,
:
<1 ALIGN=CENTER> </1>

, , <> </>.
.

HTML

611

,
ALIGN.
,
<BR>. .

HTML- ,
. <UL> </UL>,
<0L> </01>.
<LI> </LI>. .


HTML .
, :
<> ... </> ;
<!--... </!> ;
<U> ... </U> .
.
, ,
, .
:

<> ... </> ;


<STR0NG> ... </STR0NG>
;
<KBD> ... </KBD> ;
<VAR> ... </VAR> ;
<1> ... </1> - .
HTML-,
:
<HTML>
<HEAD>
<TITLE> HTML- </TITLE>
</HEAD>
<B0DY>
<H2 ALIGN=CENTER> </2>
<>
:
<UL>
<1> <>1</></1_1>
<1_1> <B>2</B></LI>
<1_1> <>3</></1_1>
</UL>
:
<01_>
<1_1> 1</LI>

612

20, -

<1_1> 2</LI>
<1_1> 3</LI>
</0L>
:
<01_>
<1><> 1</U></LI>
<UL>
<1_1><1></1> 1.1</LI>
<1_1><1></1> 1.2</LI>
</UL>
<1_1><11> 2</U></Ll>
<UL>
<1_1><1></1> 2.1</LI>
<1_1><1></1> 2.2</LI>
</UL>
<1><> 3</U></LI>
</0L>
</P>
</B00Y>
</HTML>

HTML-
,
, .
Internet Explorer . 20.1.
HTML-

&

4)

CSPSHC

^.

'

'J

&

'^ttpec fe D \MoHflOKyMeKTbr\delphi\BookVest html

"3


:
1
!
3
.
1. 1
2. 2
3. 3
:
1.

2.

3.

1


2


3

1.1
1.2
2.1
2.2

. 20.-1. HTML-

HTML

613

HTML-.
HTML- ( ),
.
<> </>.
HTML-
. <> HREF.
,
.
, HTML-, ,
:
< HREF=URL_pecypca> </>
URL-, HREF, :
:

URL- .

;
URL-
HTML-. ,
< HREF=docl.html> 1 </>

, ,
docl.html, ,
.
, ,
, , http://www.domen.ru/information/main.html,
, , http://www.domen.ru/information/
docl.html.
<>

HTML. <>
NAME:
< ="_"> </>
, <> </>,
, HTML-
:
< HREF="#nMH_MapKepa"> </>
.

(
).

614

20. -


, ,
, web-, .
<F0RM> </F0RM>.
, : ,
, . .:
<F0RM>


</F0RM>

<F0RM> ACTION METHOD:


ACTION URL- (
), ,
;
METHOD , ,
, .
: GET POST.
<INPUT>,
.
TYPE . TYPE <INPUT>
, .


TYPE "TEXT" (
).
Tera<INPUT>:
NAME ;
VALUE ,
;
SIZE ;
MAXLENGTH ,
.
, ,
t x t l 20 :
<F0RM METH0D="P0ST"

ACTI0N="http://domen.ru/scripts/test.cgi">
: <INPUT TYPE="TEXT" SIZE=20 NAME="txtl">
</F0RM>

,
. TYPE
"PASSWORD". , ,
(*).
.

HTML

615

TYPE <INPUT> "CHECKBOX".


:

NAME ;
VALUE , ,
, ;

CHECKED , ,
. .
, , "YES"
:
<F0RM METH0D="POST"

ACTI0N="http://domen.ru/scripts/test.cgi">
<INPUT TYPE="CHECKBOX" NAME="chkl" VALUE="YES" CHECKED>

</F0RM>

,
.
, .
TYPE "RADIO".
:

NAME .
, ;
VALUE ,
;
CHECKED , ,
.
HTML-
:
<F0RM METHOD"POST"
ACTI0N="bttp.7/domen.ru/scripts/test.cgi">
<INPUT TYPE="RADIO" NAME="rbl" VALUE="1" CHECKED>
<BR>
<INPUT TYPE="RADIO" NAME="rbl" VALUE="2">

<BR>
<INPUT TYPE="RADIO" NAME="rbl" VALUE="3">
<BR>
</F0RM>

:
SUBMIT ;
RESET .

616

20. -

TYPE "SUBMIT", "RESET"


, .
VALUE.
,
SUBMIT, RESET:
<F0RM METH0D="P0ST" ACTION="http://domen.ru/scripts/test.cgi">
<INPUT TYPE="SUBMIT" VALUE="0K" CHECKE0>
<INPUT TYPE="RESET" VALUE="CANCEL">
</F0RM>

,
:
<HTML>
<HEAD>
<TITLE> HTML- </TITLE>
</HEAD>
<B00Y>
<H2 ALIGN=CENTER> </2>
<F0RM METH0D-"P0ST"
ACTION="http://domen.ru/scripts/test.cgi">
: <INPUT TYPE="TEXT" SIZE=20 NAME="txtl"> ^BR><BR>
<INPUT TYPE-"CHECKBOX" NAME="chkl" VALUE="YES" CHECKED>
<BR><BR>
<INPUT TYPE-="RADIO" NAME="rbl" VALUE="1" CHECKED>
<BR>
<INPUT TYPE="RADIO" NAME="rbl" VALUE="2">
<BR>
<INPUT TYPE="RADIO" NAME=,,rbl" VALUE-"3">
<BR><BR>
<INPUT TYPE="SUBMIT" VALUE="0K" CHECKED>
<INPUT TYPE-"RESET" VALUE="CANCEL">
</F0RM>
</B0DY>
</HTML>

HTML- Internet Explorer


. 20.2.

web-
, web-, HTTP-
.
- .
,
web-, .

, web-.
,
,
Windows:

617

web-

| MTML- ^

&

&

Cgpfiaa

&

*&

fhwts

^j

# j D \floK^twfibAdeWBook^est html

^ ,

"3

CANCEI

}<

' 1 3

. 20.2. HTML-

CGI-;
ISAPI-;
(ASP, Active Server Page).

CGI-
CGI Common Gateway Interface
. CGI- -
web-.
,
CGI-.
CGI- ,
. CGI-
:
CGI- (
web-),
;
.
-,
, , ISAPI ASP. CGI

618

20. -

W W W .
CGI
web-, . , CGI
wcb-,
UNIX (Linux,
FreeBSD, Solaris . .). UNIX
, CGI
.

, Win
dows NT, CGI , ,
-.

WinCGI
WinCGI CGI-,
Windows,
, INI-.

ISAPI
ISAPI (Internet Server Application Programming), CGI,
web-
. ISAPI- CGI- ,
ISAPI
(DLL), , ,
web-. ISAPI-
CGI:

, ,
;
ISAPI web-,
, ;
CGI, ISAPI
, ,
CGI.
(
).
, , ISAPI-
, , ,
ISAPI-, web-.
ISAPI-,
, ISAPI
web-.

web-

619

ASP
ASP
Microsoft 1997 . ASP
,
HTML-. , CGI ISAPI, ASP
OLE Automation,
HTML- ,
. HTML ,
,
. , ASP
HTML-, ,
Web.
ASP CGI/WinCGI ISAPI
, ASP HTML-,
, ,
. , HTML-
ASP. HTML ASP-.
ASP
, ActiveX Delphi, Visual ++, Visual
Basic.
, ASP, VBScript
( Visual Basic, Visual Basic Scripting Edition) JScript
( JavaScript Microsoft),
HTML-. ASP- <%,
%>.
ASP- ActiveX,
VBScript,
HTML- <% %>.
- ASPObject,
ASPServer (
), Content :
ASPObject:

<% Set ASPObj = Server.CreateObject("ASPServer.ASPObject")


ASPObj.Content
%>

VBScript. ,
, , , ,
(, UNIX),
VBScript. , ASP-
,
HTML. Web-, ,
.
ASP-.

620

20. -

ASP
Windows. , ASP-
Microsoft,
- (Sun, Netscape).

,
, ASP ,
Windows. , web-, Microsoft,
Windows ( ,
web- Apache), ASP , ,
.

, VBScript JScript ,
.
PHR ASP.

,
web- .

.
, web-
.
, web-,
, ,
(, web-
).
. , HTML, ,
, ,
Windows, Linux MacOS. , -

, , ,
web- , .

web- . ,
W W W , ,
(intranet).
web-
, ,
, . 20.3.

621


CGI
ISAPI
ASP
PHP
HTTP
Web

SQL
Web

Web

. 20.3. Web

W W W
.
,
,
, , WWW-
.
Web
:

.
,
HTML-, .
HTML- WWW-.
.
.
,
, ,
, WWW;

,
, , web-
. web (CGI, ISAPI, ASP, PHP . .), WWW-
, . ,

HTML-, .
.
,
, web-.

web-
W W W
.

21


Borland Delphi 5.

Personal Web Server


web- web-.
, web-
, WWW-.
, web- ,
HTTP.
,
.
web- Apache (
60 % ). web-

. Apache ,
Windows.

, WWW-
UNIX, web- Apache
web- Active Server Page
(ASP), Microsoft.

web-
Borland Delphi ( Windows),
web-,
Windows , ASP.

CGI

623

,
Windows:
Internet Information Server (IIS) Windows NT/2000;
Personal Web Server (PWS) Windows 98.
web- (PWS
IIS,
),
PWS. Windows 98, ,
, Windows NT.

PWS,
Windows 98.

PWS : ( ) Webshare,
Web
. ,
:

Wwwroot web-.
,
default.htm default.asp;

Scripts , .

web-,
, , .
,
PWS
Personal Web Server Web.

CGI
, CGI,
Windows- ( Delphi),
Win32-cepBepoM. Internet Information
Server (IIS), Windows NT/2000, Personal Web Server
Windows 98. ,
,
HTML-,
, Win32, MacOS,
UNIX . .
CGI- : web . web--

624

21. -

HTML, ,
HTML, .
CGI-:
CGI-,
;
WinCGl CGI Windows,
INI-.

CGI-
CGI :

SUBMIT ( ,
<INPUT TYPE="SUBMIT">);

CGI- <F0RM>
ACTION, :
<F0RM ACTI0N='7scnpts/test.cgi" METHOD="GET">
CGI <>
HREF:
< HREF="/scripts/test.cgi"> Run CGI </A>

,

, .

CGI-
, CGI
.
. CGI
. Object Pascal write
wri tel n.
HTTP. (/1.0 200 ) web.
CGI. Contenttype. ,
.
Delphi CGI-,
(,
Hello, world!).
1. Delphi IDE File New,
Console Application
. ,
:

CGI

625

program Projectl;
{$APPTYPE CONSOLE)
uses SysUtils;
begin
// Insert user code here
end.
2. :
program console:
{SAPPTYPE CONSOLE}
uses
SysUtils;
begin
// Content-type
writelnt'Content-Type: text/html');
// ,
//
writeln;
// HTML-
writelrK
writeln(
writelrK
writelrK
writelrK
writeln(
writeln(
writelnC

<HTML>'):
<HEAD>'):
<TITLE>npHMep 1-</11>'
</HEAD>'):
<B0DY>');
<H2 ALIGN=CENTER>Hello. World!</H2>')
</B0DY>'):
</HTML>');

end.

3.
, web-
( scripts).

,
exe. Personal Web Server
, ,
cgi. (
)
{$}, ,
. CGI,
: {$ CGI}.
4. HTML-
, CGI-.
- ,
, .

626

21. -

HTML-,
:
<HTML>
<HEAD>
<TITLE> CGI- </TITLE>
</HEAD>
<B0DY>
<A HREF="/scripts/console.cgi"> Run CGI </A><8R><BR>
<F0RM METHOD="GET" ACTION="/scripts/console.cgi">
<INPUT TYPE="SUBMIT">
</F0RM>
</B0DY>
</HTML>

5. HTML- default.htm
Wwwroot. web-
1 1 host, IP- 127.0.0.1, .
, (. 21.1, ).

, CGI.
Hello, World!,
(. 21.1, ).
\CGI-

j
j

'.- ,>.\

^1*^:-;\^:::1(|

S.UB,

Cj^B*;

$0$4

flows*
J*j

] 5 j * j hup Wpvn/

<^!*

]>

U *

*
j

:5

v *
,.,;.

." "
&

iPajPljjjjf

a
&

" a' " ' a"" " " 'a T ' ^ r

~3

' &gpet | ^ ] http //pvn/scnpts/console eg?

Hello, World!

.,
)

;||<*><>

d:
:

. 2 1 . 1 . HTML- () CGI- ()

627

,

.
, web-,
.
, .


,
web-. SUBMIT, ,
CGI-, <F0RM> ACTION.
.
,
. ,
NAME, , VALUE
, .
:
1-1&2-2...

,
. ( )
&.
= & ,
: %,
, (,
= U3D, & %2). , ,
, . +.
.
:
_=_;
;
+ ;
,
%, ASCII.
,
.


web- :
GET, POST.

628

2 1 . -

METHOD <F0RM>:
GET URL-
CGI-. URL
?;
POST HTTP.
CGI-
, CGI-.
:

GET CGI-
QUERY_STRING;
POST CGI
.
CONTENT_LENGTH.


GET
GET CGI-
,
.
Win32 API:
function GetEnvironmentVariable( IpName: PChar; IpBuffer: PChar; nSize: DWORD): DWORD;
stdcall

:
IpName ;
1 pBuf f PChar,
;

nSi ze 1 pBuf f .

, GetEnvi ronmentVari abl e, ,


( IpName) .
,
QUERY_STRING, :
var
buff: PChar:
S t l : String;
begin

//
GetMemCbuff,200):
//
GetEnvi ronmentVari able('QUERY_STRING'.buff.200);
// PChar
Stl:=StrPas(buff);

//

629

FreeMem(buff);
end:


POST
POST
.
, ,
, , .
, .

Read Pascal.
, ,
CONTENT_LENGTH. , POST
, , ,
:
:
var
buff: PChar;
ContentLength.i: Integer:
Stl: String:
C: Char:
begin
// PChar
// CONTENT_LENGTH
GetMem(buff.50):
//
// CONTENT_LENGTH
GetEnvironmentVanab1e('CONTENT_LENGTH,,buff.50);
//
ContentLength:=StrToInt(StrPas(buff));
//
FreeMem(buff):
// ContentLength
Stl: = ' ';
for i : = l to ContentLength do begin
Read(C):

Stl:=Stl+C:
end;
end;


CGI-
, web-
, . ,
, . 21.1.

630

2 1 . -

2 1 . 1 .

REQUESTMETHOD

: GET POST

SERVER_NAME

IP-

SERVER_PORT

SERVER_PROTOCOL

PATHJNFO

,
,

REMOTEADDR

IP- ,

REMOTEHOST

, . 2 1 . 1 ,
CGI-, web-.

,
.
.
. ,
GET
POST,
,
.
:
program console:
{SAPPTYPE CONSOLE}
{$E CGI}
uses
SysUtilS.Windows:
var
buff: PChar:
ContentLength,i: Integer:
Stl.St2: String:
C: Char:
begin
GetMem(buff.50):
GetEnvironmentVariable('REQUESTJ-IETHOD'.buff. 50):
Stl:=StrPas(buff):
FreeMem(buff);
i:-Length(Stl):
while i>0 do
begin
Stl[i]:=UpCase(Stl[i]):
dec(i)
end:

631

i f St1='GET'
then begin
GetMem(buff.200):
GetEnvironmentVariable('QUERY_STRING'.buff.200):
St2:=StrPas(buff):
FreeMem(buff);
end;
i f St1-'POST'
then begin
GetMem(buff,50);
GetEnvironmentVariable('C0NTENT_LENGTH'.buff.50):
St2:=StrPas(buff);
FreeMem(buff);
ContentLength:=StrToInt(St2);
St2: = " :
for i : = l to ContentLength do begin
Read(C):
St2:=St2+C;
end:
end:

Stl:='Method '+Stl:
Stl: = '<H2 ALIGN=CENTER>'+Stl+'</H2>' :
St2:='Query string: '+St2:
St2:-'<H2 ALIGN=CENTER>'+St2+'</H2>':
writeln('Content-Type: text/html');
writeln:
writeln('<HTML>');
writeln('<HEAD>'):
writeln('<TITLE>npnMep 61-</11_>'):
writeln('</HEA0>') :
writeln('<B0DY>'):
writeln('<H2 ALlGN=CENTER>Hello. World!</H2>');
writeln(Stl):
writeln(St2);
writeln('</BODY>'):
writeln('</HTML>');
end.

HTML-
, ,
. ,
SUBMIT . HTML-
:
<HTML>
<HEAD>
<TITLE> CGI- </TITLE>
</HEAD>
<B0DY>
<H2> GET </H2>
<F0RM METHOD="GET" ACTION="/scripts/console.cgi">
<INPUT TYPE="TEXT" NAME="Editl" VALUE="Test"><BR><BR>
<INPUT TYPE-"SUBMIT">
</F0RM>
<BR><BR>
<H2> POST </H2>
<F0RM METH0D="P0ST" ACTI0N=7scripts/console.cgi">

632

21, -

<INPUT TYPE="TEXT" NAME="Editl" VALUE="Test"><BR><BR>


<INPUT TYPE="SUBMIT">
</F0RM>
</B0DY>
</HTML>

, default.htm
Wwwroot, CGI- Scripts.
web-
(localhost 127.0.0.1), ,
. 21.2, . SUBMIT, ,
GET, , . 21.2,6,
, , POST,
, . 21.2, .
, ( POST)
.
(. . 21.2, ).
CGI-. , .
, .
-
. ,
Delphi, web-.


Delphi web-
,
CGI-, :
CGI-;
CGI
;
, .

CGI- Object Pascal.
CGI-
. ,
.

web-, ,
.
, Delphi web-
CGI/WinCGI ISAPI-.

Delphi w e b -

< ^ *

3 CGI-nptinefceiiieii
|

-
*}

$afti)

Hasaft
^

.'

CejMwt'

\} hiip /'pviVscnpts/comole cgi? _^j

GET

Hello, World!

JTest

Method GET

633

Query string: Editl=Test

POST
(

J g ]

'

2 | wrpeeef

CG[- *
^

|&

0-

'dr

jBjflpcc ]4J] http //pvn/scnpis/consoie cgi

fi

13

Hello, World!
Method POST
Query string: Editl=%D2%E5%Fl%F2

S*g

. 2 1 . 2 . , CGI-:
HTML-, ;
GET;
POST

Delphi Web Module


TWebModule web-,
Delphi, CGI, WinCGI ISAPI.
HTTP-.

634

21. -

TWebModule Action,
, , .
TWebAct ion Item
:

Pathlnfo: String , (
, )
;
MethodType: TMethodType ,
, .
: mtGet, mtPost, mtHead, mtPut, mtAny.
MethodType ,
GET, POST, HEAD, PUT, ;

Default: Boolean .
true,
, ;
Enabl ed: Bool ean , (true) (f al se)
HTTP- Pathlnfo MethodType,
;

Producer: TCustomContentProducer ,
web-.
.
Actions OnActions.

.
property OnAction: THTTPMethodEvent;
type THTTPMethodEvent = procedure (Sender: TObject: Request: TWebRequest: Response:
TWebResponse: var Handled: Boolean) of object;

Request , .
Response . Handle
, , .
false.
Request Response
.

Request
Request TWebRequest
web-. ,
.
:

property Content: String , POST.


, HTTP-, ;

property ContentFields: TStrings ,


POST. ContentFi el ds -

Delphi web-

635

, ,
,
, (=);

property Query: String ,


GET;
property QueryFields: TStrings ,
GET. QueryFields
ContentFields;
property RemoteAddr: String IP- , ;
property RemoteHost: String , ;
property Method: String , .
, Request, ,
, .

, .

. WebModule
300 . ,

.

Response
Response TWebResponse ,
HTTP-.
:

property ContentType: String , ;


property ContentLength: Integer , ;
property Content: String ;
property ContentStream: TStream Stream,
.
. ContentStream ,
Content.

WebModule

, Actions,
TWebModule.
: AfterDispatch, BeforeDispatch, OnCreate OnDestroy.
:

property AfterDispatch: THTTPMethodEvent , HTTP ( OnActi ons -

636

21. -

Acti ons), .
, , HTTP-;

property BeforeDispatch: THTTPMethodEvent ,


HTTP - .
HTTP-;

property OnCreate: TNotifyEvent TWebModul e.



, . ,
, ;

property OnDestroy: TNotifyEvent WebModule.


, .
, ,
.

web- Delphi
CGI-. ISAPI-
: ISAPI/
NSAPI Dynamic Link Library (. 21.3) CGI Stand-alone executable.
ISAPI- dil.

CGI-
WebModule
CGI- ,
WebModule. ,
,
.
web-, WebModule,
:
1. .
CGI, WinCGI ISAPI.
2. , .
web-.
3. .
1 . w e b -

CGI-, WebModul e,
:
1. Delphi IDE File New
New Items New Web Server Application.
2. New Web Server Application (. . 21.3)
.
CGI-, CGI Stand-alone executable.

Delphi web-

637

. CGI-,
TWebModule.
New web Servet AppScation
ou setettiiom < e< the idfoms!) types erf WAf
i Vi*sWehsef?eppfcetSs(is,
j |SAPi*iSAf>f Djsn<n<5 U * Wy

Cancel

. 21.3. New Web Server Application

TWebModul e (TDataModul )
HTTP-. WebModule

HTTP- .
2 . ,

TWebModule
(Action), .
:
1. TWebModul e
Actions .
(. 21.4).
2. .
( Add New),
Add ,
(
Insert).
diling WebModule t. Actien;

*
Name.

*
PsWnlo

Enabled

Defati!

Ptoducei

. 21.4.

3. .
, ,
. Pathlnfo
/validate. ,

638

21. -

HTTP- ,
/val i date, : /scri pts/test. cgi /val i date.
.
4. , OnAction
. Events
.
- OnAction.
, :
.
: .
login password .
, , ,
, (
, ,
web-).
.

Login/Password correct,
Login/Password incorrect.
,
GET POST. ,
-: GET
Query QueryFields Request; POST
Content ContentFields .
:
procedure TwebModulel.WebModulelWebActionItemlAction(
Sender: TObject: Request: TWebRequest:
Response: TWebResponse: var Handled: Boolean):
//
const
login: string = 'test':
password: string = '123';
// , , .
//
var
validate: Boolean;
begin
validate:-false;
// , GET
if Request.Method-'GET' then
// , ,
//
validate:-(Request.QueryFields.Values['login']-login)
and (Request.QueryFields.Values['password']=password);
// , POST
if Request.Method='POST' then
// , ,
//
val idate:=(Request,ContentFields.Values['1ogin']-login)

Delphi w e b -

639

and (Request.ContentFields.ValLies['password']=password):
i f validate then
Response.Content: ='<H2 ALIGN=CENTER>Login/Password correct</H2>'
else
Response.Content: ='<H2 ALIGN=CENTER>Login/Password i ncorrect</H2>'
end:

Delphi IDE Project Compile


( Ctrl+F9). ,

, . cgi
Scripts.
HTML,
.
, .
,
GET, POST, ,
GET, POST. HTML
:
<>
<HEAD>
<TITLE> CGI- </TITLE>
</HEAD>
<B0DY>
<H2> GET </H2>
<F0RM METHO0="GET" ACTION="/scripts/test.cgi/validate">
HMfl:&nbsp<INPUT TYPE="TEXT" NAME="login"><BR>
:&nbsp<INPUT TYPE="PASSWORD" NAME="password"><BR><BR>
<INPUT TYPE="SUBMIT">
</F0RM>
<BR><BR>
<H2> POST </H2>
<F0RM METHOD-"POST" ACTION="/scripts/test.cgi/validate">
^:&nbsp<INPUT TYPE="TEXT" NAME="login"><BR>
:&nbsp<INPUT TYPE="PASSWORD" NAME="password"><BR><BR>
<INPUT TYPE="SUBMIT">
</F0RM>
</B0DY>
</HTML>

, , default.htm
Wwwroot. web-
CGI-.
, TWebModule
, .
, Response. Content HTML.
( ,
web-),
. Delphi ,
HTML.

640

21, -


HTML
HTML
Internet Delphi IDE.
:

HTML- ,
;
HTML-
.
.
, .

TPageProducer
HTML-
. :
property HTMLDoc: TStrings HTML-;
property HTMLFi : TFi l eName ,
HTML-.
,
.
TPageProducer Content:
function Content: string: override;

HTML-.
HTML-, ,
HTML, ,
:
<#name paraml=valuel param2=value2 ...>
TPageProducer ,
OnHTMLTag ( TPageProducer).
, .
OnHTMLTag :
type

TTag = (tgCustom. tgLink. tglmage. tgTable. tglmageMap,


tgObject. tgEmbed):
THTMLTagEvent = procedure (Sender: TObject; Tag: TTag:
const TagString: string; TagParams: TStrings;
var ReplaceText: string) of object:

Tag ,
:
tgLink LINK, ;
tglmage IMAGE, ;

Delphi web-

641

tgTable TABLE, ;
tglmageMap IMAGEMAP, -
;
tgObject OBJECT, ActiveX;
tgEmbed EMBED, ;
tgCustom , (
).
TagStri ng.
TagParams name=val ue.
Repl aceText ,
.
TPageProducer

, CGI- WebModule, TPageProducer.


IP- ,
, , .
;
1. WebModule TPageProducer.
2. HTMLDoc TPageProducer :
<1_>
<HEAD>
<TITLE> </TITLE>
</HEAD>
<B0DY>
< ALIGN=LEFT> <#RESULT> </H3>
<>: <#H0ST></P>
<>: <#NAME></P>
</B0DY>
</HTML>

3. private TWebModulel
: ResultStr LoginStr.
4. OnAction OnHTMLTag
, :
unit test_unit:
interface
uses
Windows, Messages. Syslltils. Classes. HTTPApp:
type
TWebModulel = class(TWebModule)
PageProducerl: TPageProducer:
procedure WebModulelWebActionItemlAction(
Sender: TObject: Request: TWebRequest:
Response: TWebResponse; var Handled: Boolean):
procedure PageProducerlHTMLTag(Sender: TObject:
Tag: TTag: const TagString:

642

2 1 . -

String; TagParams: TStrings;


var ReplaceText: String);
private
{ Private declarations }
ResultStr: string;
LoginStr: string;
public
{ Public declarations }
end;
WebModulel: TWebModulel;
implementation
{$R *.DFM}
procedure TWebModulel.WebModulelWebActionItemlAction(
Sender: TObject; Request: TWebRequest:
Response: TWebResponse: var Handled: Boolean):
const
login: String = 'test';
password: String = '123':
var
validate: Boolean:
begin
validate:=false:
if Request.Method'GET'
then begin
LoginStr:=Request.QueryFields.Val u e s [ ' l o g i n ' ] ;
validate:=(LoginStr=login) and
Request.QueryFields.Valuesfpassword']=password):
end;
i f Request.Method-'POST'
then begin
Logi nStr:-Request.ContentFi elds.Values['1ogi n ' ] ;
validate:=(LoginStr=login) and
(Request.ContentFields.Values['password']=password);
end:
i f validate

then ResultStr:='HMfl/naponb '


else ResultStr:='/apo ':
Response.Content:=PageProducerl.Content;
procedure TWebModulel.PageProducerlHTMLTag(Sender: TObject: Tag: TTag;
const TagString: String; TagParams: TStrings: var ReplaceText: String):
begin
if TagString-'RESULT'
then ReplaceText:=ResultStr;
if TagString='HOST'
then ReplaceText:=(Sender as
TCustomContentProducer).Di spatcher.Request.RemoteHost;
if TagString-'NAME'
then ReplaceText:-LoginStr:
end.

Delphi web-

643

,
HTML-, .

,
TPageProducer.

.


, WWW,
. , ,
web-.
HTML. VCL Delphi
, HTML-
, . :
TDatasetPageProducer;
TDataSetTableProducer;
TQueryTableProducer.

TDatasetPageProducer
TPageProducer.
, TDatasetPageProducer
DataSet. ,
, .
, , HTML, , .

TDatasetPageProducer ,
.

TDataSetTableProducer
TDataSetTableProducer web-
, .
.
WWW.
TDataSetTableProducer:
property DataSet: TDataSet ,
;

644

21. -

property Dispatcher: TCustomWebDispatcher -,


HTTP-.
TWebModul e,
TDataSetTableProducer;

property Caption: String HTML-;


property Capti onAl i gnment: THTMLCaptionAlignment .
:
caDefault web-;
HTML-;
caBottom HTML-;
property Header: TStrings , ;
property Footer: TStrings , ;
property Columns: THTMLTableColumns ,
,
.
,
Columns (
TDataSetTableProducer, );

property MaxRows: Integer (),


;
property TableAttributes: THTMLTableAttributes
:
property Align: THTMLAlign
. : haDefault
, haLeft
, haRight , haCenter
;
property BgColor: THTMLBgCol or .
: Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy,
Olive, Purple, Red, Silver, Teal, White, Yellow;
property Border: Integer ( ),
. - 1 , ;
property Cell Padding: Integer (
). - 1 , web-;
property Cel I Spaci ng: Integer (
). - 1 , web-;
property Width: Integer
;
property RowAttributes: THTMLTableRowAttributes
. THTMLTableRowAttributes ,
, Al ign BgCol or, -

Delphi web-

645

THTMLTabl eAttri butes.


:
property VAlign: THTMLVAlign
. : haVDefault
, haTop
, haMiddle , haBottom
;
property Custom: String
.

HTML-

HTML. sales.mdb.
:
1. web-.
2. WebModul e : TADOTabl e TDataSetTabl eProducer.
ADOTablel DataSetTableProducerl.
3. ADOTablel
sales.mdb.
4. DataSet DataSetTabl eProducerl ADOTabl el.
5. Caption DataSetTableProducerl
:
<2> </2>

6. Header DataSetTabl eProducerl :


<>, 1-</>
7. Footer DataSetTabl eProducerl :
<>, 1-</>

8. HTML-.
DataSetTabl eProducerl
Col umns .
,
HTML-,
.
,
(. 21.5). , HTML, , .
9. ,
DataSetTableProducerl, Add All Fields
. ,
. 21.5. Border, 1 (
).

646

21. -
: * f Editing DatdSetTdbleProducerl.Columns

# #

t_3

fw***^
ASS"

|haDelault

jjotifcr |1
&;|

d
jd

CtsteafcSng: j-i
j-1

5#sh.|ioo

*
TWideStnngField
TWideStrtngField
TWideStnngField
TWideStnngField
TWideStringField
TWideStnngField
TWideStnngField
TWideStringField

, HTML-

11 ;! ! :! || ;| [ \

, HTML-

. 21.5. TDatasetTableProducer

10. WebModul e
. Path Info ,
.
OnAction :
procedure TWebModulel.WebModulelWebActionItemlAction(
Sender: TObject: Request: TWebRequest:
Response: TWebResponse: var Handled: Boolean):
begin
Response.Content:=DatasetTableProducerl.Content:
end:

11.
, .
OnCreate OnDestroy TWebModule.
ADOTablel, :
procedure TWebModulel.WebModuleCreate(Sender: TObject):
begin
ADOTablel.Open;
end;
procedure TWebModulel.WebModuleDestroy(Sender: TObject):
begin
ADOTablel.Close:
end;

web-,
HTML-, .
,
cgi Scripts.

Delphi web-

647

HTML,
.
, SUBMIT:
<HTML>
<HEAD>
<TITLE> HTML- </TITLE>
</HEAD>
<B0DY>
<F0RM METHOD="GET" ACTION="/scripts/test.cgi">
<INPUT TYPE="SUBMIT">
</F0RM>
</B0DY>
</HTML>

. 21.6.
Hhttp://pvn/eciipls/testcgf? S.SM

**

&

*
;<***1

hltp //pvn/scnptsAesl cgi?

&

0*w*

"3

^ |

, HTML-


||

|11;| I

11(383)224113124

i!630090 :|

(048)056^;;
I4634

: :|

||

;|
\
!|

11270005 !

= ^ ^

( |. , . 34

-(
|.

, . :1

^ ^

i!

1(048)034115874

270029 ^ |

|. , . 42

(816)025-"
116128

11173024 ;; (

|. , . 18

ii,,,
1[.'.??.

1173003 :|
II...
1

.,'
I?' ' ' '

, HTML-

. 2 1 . 6 .

TDatasetTabl eProducer ,
:
Q type TCreateContentEvent = procedure (Sender: TObject: var Continue: Boolean) of
object: property OnCreateContent: TCreateContentEvent
HTML-. ,

648

21, -

Continue false.
, , , ,
HTML-;
Q THTMLFormatCellEvent = procedure (Sender: TObject: CellRow, CellColumn: Integer; var
BgColor: THTMLBgColor: var Align: THTMLAlign; var VAlign: THTMLVAlign: var CustomAttrs,
CellData: string) of object; property OnFormatCel 1: THTMLFormatCel 1 Event
HTML-. Cel I Data
, .
-.
OnFormatCel 1
. , ,
, :
- , (. 21.7):
procedure TWebModulel.DataSetTableProducerlFormatCelH
Sender: TObject; CellRow, CellColumn: Integer;
var BgColor: THTMLBgCol or; var Align: THTMLAlign;
var VAlign: THTMLVAlign; var CustomAttrs,
CellData: String);
begin
if Odd(CellRow)
then BgColor:='Silver'
else BgColor:='';
end;

TQueryTableProducer
TData SetTabl eProducer: TQuery
SQL-
, HTTP-, ,

, HTML-.
TQueryTableProducer

CGI- ,
, ,
. :
1. TADOTabl e TQuery, a TDatasetTableProducer TQueryTableProducer. TQuery
TableProducer , TDatasetTableProducer, ,
Query.

Query TQueryTableProducer
TQuery. TADOQuery TIBQuery TQueryTableProducer
.

Delphi web-
Mtp://pvn/sciipU/lest.cgi?

g.no,

649

'

J>

'.

hUp //pvn/scriDtsAest cgi?

, HTML-


:|

:!

]1

1(048)0564634

^'

074

^,~0

\~,j

"

'

;|; !

270005 ^

|. ,
!23

27&G29 >

. 42

173024

, , 18

173003

,,"'
41

::

'

, HTML-

. 21.7. OnFormatCell
2. , HTML-,
OnAction , WebModule.
, OnCreate
OnDestroy WebModule (
):
procedure TWebModulel.WebModulelWebActionItemlAction(
Sender: TObject: Request: TWebRequest:
Response: TWebResponse: var Handled: Boolean):
begin
Response.Content:='<HEAD><TITLE>'+
' TQueryTableProducer'+
'</TITLE></HEAD>'+QueryTableProducerl.Content;
end:
procedure TWebModulel.WebModuleCreate(Sender: TObject);
begin
ADOTablel.Open:
Query1.Open:
end;
procedure TWebModulel.WebModuleDestroy(Sender: TObject);
begin
ADOTablel.Close;
Query1.Close;
end;

650

21, -

3. TQuery BDE (Borland


Database Engine), MS Access 2000
ODBC.
sales.mdb TQuery ODBC.
ODBC Data Sources Windows.
4. , DatabaseName
TQuery. , SQL :
SELECT *

FROM [ ]
WHERE (=:)

5. HTML-, CGI-, City, , ,


SQL-. ,
, , ,
, .
HTML-, ,
TEXT CITY:
<HTML>
<HEAD>
<TITLE> HTML- </TITLE>
</HEAD>
<B0DY>
<F0RM METH0D=MP0ST" ACTI0N='7scripts/test.cgi">
:&nbsp<INPUT TYPE-"TEXT" NAME="CITY"><BR><BR>
<INPUT TYPE="SUBMIT">
</F0RM>
</B0DY>
</HTML>

, , . 21.8, ,
. 21.8, .

ASP
Active Server Pages
ASP, , (
ASP ASP-),
, web-.
I Request I Response.

ASP- web-
ASP web- IRequest
Iresponse:
IRequest ,
, ( ,
HTML-);

651

ASP Active Server Pages

::;;

I 'Zl HTML -

j '

'

is '

* 4 *
*

fltwre

-
j j

j & S W t j f i htlp//bcalhosl/

<HlpMftj

|
f

1 *08

\\

j$

gliy

te.liN'1. ,-)! ,Hi.->.-H-W.

TQueryTablePioducer -

4
I-

'

'HI--

<5**

*
j j

; j f i w e e j<SJ blip //bcalhost/saipts/tesl cgi

^ ,

13

, HTML-


ii !!

ji

;!;;|1

:1:? ;(816)025-6128 173024 [ . , . 18

^ |(816)025-6156 173003 :1 !;. --, . 41

| :;!;(816)017-7124jj 173003 :; . .-, . 38


, HTML-
'1>

"

'

'

'

......

. 2 1 . 8 . TQueryTableProducer: a HTML-,
web-;

I Response ,
HTML, .
, ASP CGI/WinCGI ISAPI.
ASP web- :
, ,
, .
ASP CGI/WinCGI ISAPI,
, , ASP,
HTML, HTML-,
. HTML-
ASP.
, , .
CGI/WinCGI/ISAPI
web- .

652

21, -

ASR HTML,
web-.
HTML .

ASP
ASP OLE Automation, , :
(-),
;
(
DLL). web-.
ASP,
, .
-
, -,
.
(Threading Model), ASP-cep.
, ASP ( )
ASP CGI-, ISAPI-.


ASP Delphi
ASP ,
Borland Delphi.
1. ActiveX. Delphi
File New.
New Items ActiveX ActiveX Library.
ActiveX.
2. Active Server Object.
File New.
ActiveX Active Server Object.
. New Active Server Object (. 21.9).
3. , New Active Server Object,
:
, CoClass Name;
,
Instancing;
,
Threading Model.

653

ASP Active Server Pages


New Servei Unmet
\ CCjQta Nit
XfiStafXSngt

FirslASP

T3l

] Multiple Instance

, "QttadK^ Mpdet jApailnieur


1

~:

Atbve^efcrat Type
fiass-teveJeveftHseftaistOoSleitP^ie/OnEndPaeel

"OfjlBRS' "~
F gefleiitetemplate(est aptfar(his ctljeat

'

. 21.9. New Active Server Object

. FirstASP. Instancing
,
.
, ,
, :
Single ASP-
.
,
,
;
Apartment
.
,
. rtment
. ,
ASP- ,
;
Free,
- .
,

. ,
, .
, Apartment.
, New Active Server Object,
web- Active Server Type
Generate a template test script for this object.
web-,
ASP:

654

21. -

IIS 3 4 Pagelevel events methods;


IIS 5 Object Context.
Generate a template test script for this object Delphi
HTML-,
ASP-.

ASP, Page-level events methods,


IIS 5. ,
Object Context.

5. .
(
unitl.pas). ,
, Delphi
. I Fi rstASP,
( Page-level events methods,
OnStartPage OnEndPage).
FirstASP.asp, HTML, VB-,
ASP ( ASP-).
6. , ASP
. (. 21.10)
IFi rstASP New Method.
ESFiislASP.Ub

J * 4 * < & : f**


* FnstASP
- P IFitslASP
& FnstASP

tf'3'

A W * s jpaao&w j Boss j Text |


HmnH

| Content

- ; . ,

~~~~~~i~~~~~~

Slung

Kttp umleifc
Hlp Stars C o * *

. 21.10.

ASP Active Server Pages

655

IFirstASP Content.
,
. Refresh
.
TFi rstASP,
Implementation :
TFirstASP - classCTASPMTSObject. IFirstASP)
protected
procedure Content: safecall;
end:
implementation
procedure TFirstASP.Content:
begin
end;

7. Content.
Response TFi rstASP
( TASPMTSOb j ect). Response
I Response.
. Write.
,
. ,
. Assigned.
, Content :
procedure TFirstASP.Content:
begin
i f Assigned(Response)
then Response.Write(', ASP-');
end:

8. ASP- .
.
, web-. Personal Web Server
Scripts.
( Project Options,
Project Options).
Ctrl+F9
Project Compile.
ASP .
Delphi: Run Register ActiveX Server.
ASP.
FirstASP.asp,
Delphi. HTML:
<HTML>
<B0DY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>

656

21. -

<> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<% Set DelphiASPObj = Server.CreateObjectC'Projectl.FirstASP")
Del phiASP0bj.{Insert Method name here}
%>
<HR>
</B0DY>
</HTML>

,
({Insert Method name here}) ASP-,
. Content. VB-, ASP, :
<% Set DelphiASPObj = Server.CreateObjectC"Projectl.FirstASP")
DelphiASPObj.Content
%>

defauLt.asp
Wwwroot. web- 1 ! host.
ASP- (. 21.11).

1 Testing Delphi ASP '}

1
'*"'
\
Hwaa
j&BWijjgl hllp //localhost/

&

Y o u s h o u l d see t h e r e s u l t s of y o u r Delplii A c t i v e S prver m e t r o d b e l o w

ASP-

JSSJ

jjs} MSTM> *>

"

. 21.11. ASP-

ASP- ,

web-
. ASP-,
web-, ,
HTML-. ASP
IRequest.

IRequest
IRequest Request,
. Request
TASPObject, , ASP-.

ASP- ,

657

I Request:
Q ServerVariables ,
web-;

QueryString ,
HTML- GET;

Form HTML-,
HTTP- POST.
,
IRequestDictionary (
).
:

property Count: SYSINT read Get_Count ,


;

property Key[VarKey: 01 eVariant]: OleVariant read GetJCey


( );
property Item[Var_: OleVariant]: OleVariant read Get_Item: default
( ,
HTML-).

Item
, . ,
S:-Request.ServerVari ables.Item['REQUEST_METHOD'];
S REQUEST_METHOD
, .

S:-Request.Form.Item['Name'];
S ,
, () Name,
S: "Request.Form.Item[2];

, ,
2.
, ,
Index, ,
,
.

ASP-,
,
ASP-,
, .
ASP-, ,

658

21. -

ASP Delphi.
Content.
Content HTML-,
,
, ,
, , .
1.
, ,
EDIT.
Content :
procedure TFirstASP.Content;
var
RM.Ret.Sl.S2.Edit: String:
Count.1: Integer;
begin
if Assigned(Request)
then begin
// ,
RM:-Request.ServerVariables.Item['REQUEST_METHOD' ];
Ret; = 'flaHHbie '+RM+'<BR>';
// GET.
// QueryString
if RM='GET'
then begin
//
Count:=Request.QueryStri ng.Count;
// , EDIT
Edit:-Request.QueryStri ng.Item['EDIT'];
Ret:=Ret+'Ha '+
IntToStr(Count)+' <^>':
Ret:=Ret+' :<BR>':
//
for i:=l to Count do begin
SI:-Request.QueryStri ng.Key[i];
S2:-Request.QueryStri ng.Item[i];
Ret:-Ret+Sl+' = '+S2+'<BR>';
end;
end:
// POST,
// Form
if RM='P0ST'
then begin
//
Count:=Request.Form.Count;
// , EDIT
Edit.:-Request.Form. Item[ 'EDIT' ]:
Ret:=Ret+'Ha '+
IntToStr(Count)+' <[>';
Ret:=Ret+' :<BR>':
//
for i:=l to Count do begin
SI:-Request.Form.Key[i]:
S2;-Request.Form.Item[i]:

ASP- ,

659

Ret:-Ret+Sl+' - '+S2+'<BR>':
end;
end;
Ret:=Ret+'<HR>'+
' : '+
Edit+'<BR>';
end;
//
if Assigned(Response)
then Response.Write(Ret);
end;

2. Content,
Scripts.

Item Key QueryString, Form ServerVariables


, :
Item,
. -
, Item ( Key), , :
S2;=Request.QueryString.Item[i]+'<BR>':
. , .
Content : Invalid
variant operation.

3. VB-, -
Fi rstASP Content .
, Delphi.
:
<HTML>
<B0DY>
<TITLE> ASP- </11_>
<CENTER>
<> , ASP- </>
</CENTER>
<HR>
<% Set DelphiASPObj = Server.CreateObjectC'Projectl.FirstASP")
Del phiASPObj.Content

%>
<HR>
</B0DY>
</HTML>

4. , asp.
test.asp , Web.
Wwwroot.
5. ASP ,
Edit
SUBMIT BUTTON:
<HTML>
<HEAD>
<TITLE> ASP- </TITLE>

660

21. -

</HEAD>
<B0DY>
<F0RM METH0D="P0ST" ACTION="test.asp">
:&nbsp<INPUT TYPE="TEXT" NAME="EDIT"><BR><BR>
<INPUT TYPE="SUBMIT" NAME"BUTTON">
</FORM>
</BODY>
</HTML>

, ACTION test.asp,
Project1.dll.

6. HTML-, , default.htm
Wwwroot.
7. web- 1 ocal host ( 127.0.0.1).
1- 6-,
, default.htm.
(. 21.12, ).
8. (, String of text)
. ,
HTML-, test.asp,
HTML-, ASP.
, ,
, (. 21.12, ).

ASP
ASP- TWebModule,
ASP-, ,
, CGI ISAPI,
:
;
.
ASP-
,
. :
, sales.mdb,
,
;
,
EDIT SUBMIT.
ASP ,
, , ASP-
- Content;

661

ASP

ASP-,

Content.
;

115->..^:;?^
J 3

Qpawa

"*

'''*,-

*5*(

::;5; ^ ^ ^ ! ] | ^

J1

'""3""

jAapecje] w i p / / i 2 7 o o v

j j

^ '

^3
J

'^J

1111111111

|-| 5-* *^:-;:-?:

j 3 &

>

^
- ^

fipssx.

13

4}

-""

...

1<>

zl

j # ] hHp / / 1 2 ? 0 0 1/Vetf asp

, ASP-ce
POST
2
:
EDIT = String of text
BUTTON
: String of text

..*$

. 21.12. ASP- , : ,
; ,


,
: , TQuery, TADOTable, TADOQuery . .
, .
ASP- ,
, .
(, ,
)
. -
( -), TADOQuery,

662

2 1 . -

.


.

,
.
,
.

ASP, :
1. Delphi IDE File New.
2. New Items New
Data Module.
3. .
dm.pas.



(
). ,
.
1. . (
dm) uses -:
interface
uses
ComObj. ActiveX. AspTlb. FirstASPJIB. StdVcl. DM:

2. - ,
TDataModul el ( , ):
TFirstASP = classdASPMTSObject. IFirstASP)
private
FDM: TDataModulel;
protected

procedure Content; safecall:


end;

3.
.
TFi rstASP.
AfterConstruction BeforeDesctruction.
TFi rstASP TObject VCL.
Af terConst ructi on TFi rstASP,
BeforeDesctruction . ,

ASP

663

( TFi rstASP,
FDM) Af terConstructi on,
BeforeDesctruction.
,
publ ic, override:
TFirstASP = class(TASPMTSObject. IFirstASP)
private
FDM: TDataModulel:
protected
procedure Content; safeca11:
public
procedure AfterConstruction: override:
procedure BeforeDestruction; override:
end:

4. :
procedure TFi rstASP.AfterConstructi on:
begin
inherited:
FDM:=TDataModulel.Create(nil):
end:
procedure TFi rstASP.BeforeDestructi on;
begin
if Assigned(FDM)
then FDM.Free:
inherited;
end:

ASP-
] TADOConnect i on
TADOQuery. TADOConnection ,
Login- ( ,
, )
.

:
1. ConnectionString, TADOConnection
sales.mdb.
, .
2. Connection ADOQueryl (
TADOQuery, ) ADOConnectionl (
TADOConnection, ).
3. SQL ADOQueryl SQL-:
select *
from
where like :pl

664

21, -

, 1,
,
HTML-. ,
, ,
.

.
, ASP-,
.

,
Content TFi rstASP.
, , :
1. ,
.
2. ,
EDIT HTML-.
3. , ,
pi SQL-.
4. HTML, .
5. web-, .
Content, , :
procedure TFirstASP.Content;
var
RM.Ret,Name: String;
// -
// IRequestDictionary
Parameters: IRequestDictionary;
Count,FCount.i,j: Integer;
begin
if Assigned(Request)
then begin
// ,
RM:-Request.ServerVari ables.Item['REQUEST_METHOD'];
if RM='GET'
then Parameters:-Request.QueryString;
if RM='P0ST'
then Parameters:=Request.Form;
Name:-Parameters.Item['EDIT'];
//
if FDM.ADOQueryl.Active
then FDM.ADOQueryl.Close;
// .
// SQt-
FDM.ADOQueryl.Parameters.ParamByName('),Value:=
T+Name+X :
// SQL-

ASP

665

FDM.ADOQueryl.Open:
//
Count:=FDM.ADOQuery1.RecordCount:
FCount:=FDM.ADOQuery1.Fields.Count;
if Count>0
then begin
FDM.ADOQuery1.First;
Ret:'<table border="l" width="100r cellpadding="5">
Ret:=Ret+'<tr>':
for j:=0 to FCount-1 do begin
Ret:=Ret+'<td valign="top">';
Ret:=Ret+FDM.AD0Queryl.Fie1ds[j].FieldName;
Ret:=Ret+'</td>':
end:
Ret: - R e t + W t r ^ ;
for i:=l to Count do begin
Ret:=Ret+'<tr>':
for j:=0 to FCount-1 do begin
Ret:=Ret+'<td>&nbsp';
Ret: =Ret+FDM.ADOQuery1.Fi elds[j].AsStri ng:
Ret:=Ret+'</td>':
end;
Ret:=Ret+'</tr>':
if i<Count then FDM.ADOQuery1.Next;
end;
Ret:=Ret+'</table>';
end
else
Ret: = '<H4>flaHHbix. , </4>';
FDM.ADOQuery1.Close;
end;
//
if Assigned(Response)
then Response.Write(Ret);
end;


,
ASP-, ,
.
1. , ,
, :
<1_>
<HEAD>
<> ASP-
</11>
</HEAD>
<B0DY>
<F0RM METHOD="GET" ACTION="search.asp">
:&nbsp<INPUT TYPE="TEXT" NAME="EDIT"><BR><BR>
<INPUT TYPE="SUBMIT" VALUE="noncK">
</F0RM>
</B0DY>
</HTML>

666

2 1 . -

2. , , default.htm
Wwwroot.
3. , search.asp,
ASP-:
<HTML>
<B0DY>
<TITLE> </TITLE>
<CENTER>
<> : </>
</CENTER>
<HR>
<% Set DelphiASPObj =
Server.CreateObject("Project1.Fi rstASP")
DelphiASPObj.Content
%>
<HR>
</B0DY>
</HTML>

^i^^^^eWl^R

1-it ASP- j & * t *


,|

f:'i>i"a

1 *

ii

' \ j e ] hllp //bcalhost/'

Pi

J
jdelphi
|
~

|0>

- ~

I 1 53**
j

* 1 1 0

S
* -'~f'

C$56ws

&ct-arto$tfr&

HI

^dwepwrii

lanpocv

jj

j AjSSet j g ] htlp //localhost/seaich asp'EDIT-delphi

Delphi 5

180

i "Delphi 5 "

25

fsj **

. 2 1 . 1 3 . ASP- : ,
ASP-; , ASP-

ASP

667

4. , , search.asp
Wwwroot.
5. web- local host ( 127.0.0.1).
,
default.htm (. 21.13, ).
6. (, Delphi)
.
, HTML-, test.asp,
HTML-, ASP.
, ,
Delphi (. 21.13, ).


,
, , ,
.
, ,
.
-
.
.
,
.
-
,

.

abstract 208
ActiveForm 589, 591
ActiveX 219, 428, 515, 552, 586
AddRef 557
ADO 215, 253, 259, 266, 312, 386, 397
ALL 326
ALTER TABLE 127, 128, 129, 132, 133
ADD 127
DROP 127
MODIFY 127
AND 327
ANSI SQL 92 122, 124, 126, 134,313
AnsiChar 180
AnsiString 183
ANY 326
Application 520, 522, 527, 547, 548
522, 548
Activate 548
Help 548
Quit 522, 549
520
ActiveDocument 521
Documents 521
Options 521
Selection 521
Visible 521
array 183
ASC 136, 329
ASP 617, 619, 620, 622
ASP- 650, 652, 654, 656, 660
652
652
automated 210
AVG 333

BDE 215, 217, 253, 259, 266, 386, 393, 397,


BETWEEN...AND 323

BIT 125
BIT VARYING 125
BLOB 102
Boolean 180
Borland Delphi 63
break 193
Byte 179
ByteBool 180

Cardinal 179
CASCADE 134, 140, 149, 150
case 186
CASE- 58, 61, 65, 66, 151-153,
155-157, 165, 171
CASE- 154, 155, 156
Cells 535
CGI- 623-625, 632, 636, 648
WinCGI 624
624
624
CGI- 616,617,623, 624, 628, 630, 632
627
Char 180
CHARACTER 123
Chart 539, 543
545
ChartWizard 545
ChartObjects 543
Charts 535, 539, 543
543
ChartTitle 543
ChartType 543
HasAxis 544
HasDataTable 544
HasLegend 544
HasTitle 544
Legend 543
CHECK 128, 134
class 200

670
CLSID 554
CoClass 558, 568, 574
COM 210, 510, 552, 576
558
652, 661
518
COMMIT 92
Comp 181, 182
Component Object Model 510
Const 177
CONSTRAINT 135
constructor 209
continue 193
COUNT 333
CREATE INDEX 136, 137
CREATE PROCEDURE 141
CREATE TABLE 126, 129, 144
CREATE TRIGGER 142
CREATE UNIQUE INDEX 136
CREATE VIEW 139, 346
CreateOleObject 513-515, 585
Currency 181, 182

D
DATE 125
DDE 513
Decision Cube 383
DEFAULT 135
default 206
DELETE 143
DELETE FROM 147
DELETE OF 134
Delphi 215, 216, 228
Delphi IDE 217
217, 218

Component 229
Database 229
Edit 220
File 218
Project 225
Run 228
Search 221
Tools 230
View 222
218, 231

QReport 232
ActiveX 233
Additional 232
ADO 232
Data Access 232
Data Controls 232
Decision Cube 232
Dialogs 233
FastNet 232


Delphi IDE ()

InterBase 232
Internet 232
InternetExpress 232
Samples 233
Servers 233
Standard 232
System 232
Win 3.1 233
Win32 232
218, 230, 231
DESC 136, 329
destructor 209
dispid 577, 583
dispinterface 576
Dispose 187
DISTINCT 320, 334, 335
DMT 207
DNS- 601
Document 522, 524, 525, 527, 522, 524, 549
526
Activate 526
CheckSpelling 526
Close 526
Range 526
Save 526
Undo 526
525
AttachedTemplate 525
Auto Hyphenation 525
Content 525
FullName 525
GrammarChecked 525
GrammaticalErrors 525
Name 525
PageSetup 525
Paragraphs 525
Readonly 525
Saved 525
SaveFormat 525
ShowGrammatical Errors 525
ShowSpellingErrors 525
Styles 525
Tables 525
TablesOfContents 525
Type 525
Words 525
522
Close 524
Item 524
Open 523
Save 524
522
Count 522
DOUBLE 125
Double 181, 182


DROP INDEX 137
DROP PROCEDURE 142
DROP TABLE 128, 348
DROP TRIGGER 143
DROP VIEW 140, 347, 348
dynamic 207

E
EAbstractError 208
EmptyParam 516
ER- 153
154
154
153
ER- 153
ExcelApplication 518, 520
Exception 211
EXECUTE 142
EXISTS 325
Extended 181, 182

F
finalization 199
Finalize 184
FLOAT 125
FloatToStr 240
FloatToStrF 240
for 192
FOREIGN KEY 132
FreeAndNil 187
FreeMem 187
FULL OUTER JOIN 341

G
GetEnvironmentVariable 628
GetLongHint 445
GetMem 187
GetShortHint 445
goto 190
GRANT 149
GROUP BY 334-336, 345
GUID 554

H
HAVING 336, 345
HTML Help 465
466
HTML Help Workshop 468, 472, 473, 476
HTML- 603, 608, 609, 626, 631
610
611
610
609
611
610

671
HtmlHelp 447, 480
HTTP
634, 636, 657
605
607
606
616
604
604

I
IClassFactory 558
558
CoCreatelnstance 558
LockServer 558
IDispatch 510, 513, 540, 543, 577, 581
Idispatch 540
IDL 562
IID 554
implementation 199
IN 324
inherited 209
initialization 199
INSERT 143
INSERT INTO 143, 144, 145, 148
Int64 179
INTEGER 124
Integer 179
interface 199, 516, 559
Interface Description Language 562
Internet Information Server 623
INTERVAL 125
intranet 620
IntToStr 240
Invoke 577, 583
IP- 598, 599, 600, 601, 605
IP- 599
IRequest 650, 656
657
Form 657
QueryString 657
ServerVariables 657
IRequestDictionary 657
657
Count 657
Item 657
Key 657
IResponse 650, 651
IS NULL 322
ISAPI- 636
ISAPI- 617
IUnknown 510, 554, 556, 559, 577
554
AddRef 554
Querylnterface 554
Release 554

672

L
Label 176
LEFT OUTER JOIN 341
LIKE 324
LongBool 180
Longlnt 179
LongWord 179

M
MAX 333
Microsoft Office 510, 511
MIME 604, 605, 607
MIN 333
MS Excel 511
MS Outlook 511
MS Word 511

N
New 187
nil 187
NOT 329
NOT NULL 128
Null 188

Object Pascal 175, 215, 216


ODBC 63, 260, 312, 343, 348, 511, 512
OLE Automation 510, 512, 513, 533, 552, 576
OLE DB 63, 260, 312, 343
OleVariant 514, 524, 526, 585
OR 328
ORDER BY 329, 334, 335, 341, 345
OUTERJOIN 341
OutlookApplication 518, 520
overload 209
override 208

P
Paragraph 527
527
Alignment 528
FirstLinelndent 528
Hyphenation 528
Leftlndent 528
LineSpacing 528
LineSpacingRule 528
Rightlndent 528
SpaceAfter 528
SpaceBefore 528
527
Add 527
Item 527
Personal Web Server 623


pointer 187
Power Designer 157, 159
171
163

168
165

161
159
164
170
160
PowerPoint 511
PowerPointApplication 518, 520
Presentation 547, 549
550
Add 549
AppIyTemplate 550
Close 550
Item 549
Open 549
Save 550
550
ColorSchemes 550
Fonts 550
PageSetup 550
Slides 550
SlideShowSettings 550
PRIMARY KEY 130
private 210
procedure 194
Program 175
property 205
protected 210
public 210
published 210

Q
Querylnterface 554, 556, 574
Quick Report 354, 355

R
raise 212
Range 526-529, 541
529, 541
Collapse 530
Copy 530
Delete 541
Insert 541
InsertAfter 530
InsertBefore 530
Merge 541
Paste 530
Select 541

673


Range ()
529, 541
Bold 529
End_ 529
Font 529
Formula 541
Italic 529
Start 529
Underline 529
Value 541
read 205, 206
Real 181, 182
record 185
REFERENCE 148
Release 557
repeat... until 193
RESTRICT 140, 149
RESTRICTED 134
result 197
REVOKE 149, 150
RIGHT OUTER JOIN 341
ROLLBACK 92

s
SELECT 139, 140, 145, 148, 318, 319
Selection 527-529
529
Copy 530
InsertAfter 530
InsertBefore 530
Paste 530
TypeText 529
529
set 185
SetLength 184
Sheets 535, 539
539
Add 539
539
Item 539
Short Int 179
ShortString 182
Single 181, 182
Slide 547, 551
551
Copy 551
Delete 551
Select 551
551
Background 551
ColorScheme 551
HeadersFooters 551
Layout 551
Master 551
Name 551
Shapes 551

Slides 547, 550


550
Add 550
Item 551
Paste 550
Range 551
SMALLINT 124
Smalllnt 179
SQL- 253, 312, 381, 384, 388
SQL- 348
SQL- 28, 215, 312
String 183
StrToFloat 244
StrToInt 244
StrToIntDef 244
SUM 333

T
Table 531, 532
532
Cell 532
532
Borders 533
Columns 533
Rows 533
Tables 531
531
Item 531
Tables 531
531
Count 531
TabOrder 295
TabStop 295
TAction 422

OnExecute 422
TActionList 422
422
Images 422
Name 422
Tag 422
TADOCommand 313
TADOConnection 663
TADODataSet 313
TADOQuery 259, 313, 314, 348, 398,
405, 661, 663
TADOStoredProc 313
TADOTable 259, 661

ConnectionString 259
TableName 261
TApplication 430, 433
434
BringToFront 434
HelpCommand 478
HelpContext 478

674
TApplication {)
434
Hclpjump 478
Minimize 434
ProcessMessages 434
Restore 434
Terminate 434
434
Active 434
CurrentHelpFile 434
ExeNamc 434
Handle 434
HelpFile 434
Hint 434
HintColor 445
HintHidePause 445
HintPause 445
Icon 434
MainForm 434
ShowHint 445
434
OnActionExccute 434
OnActivate 434
OnDeactivite 434
OnHelp 479
OnMessage 434
OnShortCut 434
OnShowHint 445
TApplicationEvents 434
TArrayField 265
TAutoObject 578
TBLOBField 265, 269
TBooleanField 265
TButton 237, 238

Anchors 237
Cancel 237
Caption 237
Default 237
Enable 237
Font 237
Left 237
Modal Result 237
TabOrder 237
TabStop 237
Top 237
Visible 237

OnClick 238
TChart 404
TChartSeries 405, 409
TCheckBox 241, 425

AllowGrayed 241
Caption 241
Checked 241
State 241


TColorDialog 251
252
Color 252
CustomColors 252
Options 252
TColumn 268
268
Alignment 268
Color 268
DropDownRows 268
FieldNamc 268
Font 268
PickList 268
PopupMenu 268
Showing 268
Title 268
Visible 268
Width 268
TComboBox 247, 423
247
DropDownCount 247
DroppedDown 247
Itemlndex 247
Items 247
MaxLength 247
SelText 247
Sorted 247
Style 247
TCoinObject 558
TComponent 237, 273
TControl 274
TControlBar 426, 427
TCoolBand 426, 427
TCoolBar 426, 427
- 599
TCP- 605
TCustomControl 273
TDataLink 282
282
UpdateRecord 282
282
Active 282
ActiveRecord 282
DataSet 282
TDataSet 254
TDataSetField 265
TDatasetPageProducer 643
643
DataSet 643
TDataSetState 257
TDataSctTablcProducer 643, 644, 648
643
Caption 644
CaptionAlignment 644
Columns 644
DataSet 643

675


TDataSetTableProducer ()
643
Dispatcher 644
Footer 644
Header 644
MaxRows 644
Row Attributes 644
TableAttributes 644
TDataSetTableProducer 643
647
OnCreateContent 647
OnFormatCell 648
TDataSource 265, 266

Edit 266
IsLinkedTo 266

AutoEdit 266
DataSet 266
Enabled 266
State 266

OnDataChange 266
OnStateChange 266
OnUpdateData 266
TDataSourceLink 282
TDBChart 404, 405, 412
TDBCheckBox 270
TDBComboBox 270
TDBEdit 269
TDBGrid 267, 302
267
Columns 268
DataSource 268
DefaultDrawing 268
FieldCount 268
Fields 268
Options 268
Readonly 268
SelectedField 268
Selecteedlndex 268
TDBImage 270
TDBListBox 270
TDBMemo 269
TDBNavigator 271, 295, 303, 384
271
Before Action 271
OnClick 272
TDBRadioGroup 270
TDBText 269
TDecisionCube 383-385, 388, 390, 397, 400
TDecisionGraph 384, 404, 409, 410
TDecisionGrid 384, 385, 391, 397, 400, 401
TDecisionPivot 384, 400, 403, 410
TDecisionQuery 384-386, 393, 400
TDecisionSource 384, 385, 391

TeamSource 486
507
496

History 505
500
499
502
508
TEdit 243, 423
243
AutoSelect 244
CharCase 244
Readonly 244
SelText 244
Text 244

OnChange 243
TExcelApplication 535, 538
TExcelChart 535
TExcelWorkbook 535, 540
TExcelWorksheet 535, 539, 540
TField 262
263
Assign 263
Assign Value 263
Clear 263
IsBlob 263
IsValidChar 263
SetFieldType 263
262
Alignment 262
AsBoolean 262
AsCurrency 262
AsDateTime 262
AsFloat 262
Aslnteger 262
AsString 262
AsVariant 262
Calculated 262
CanModify 262
ConstraintErrorMessage 262
CurValue 262
CustomConstraint 262
DataSet 262
DataSize 262
DataType 262
DefaultExpression 262
DisplayLabel 262
DisplayText 262
Field Kind 262
IsIndexField 262
IsNull 262
KeyFields 262
Lookup 262
NewValue 262
OldValue 262

676
TFicld ()

Readonly 262
ValidChars 262
Value 262
Visible 262
TFieldDataLink 282, 283
283
Edit 283
Modified 283
Reset 283
283
CanModify 283
Field 283
FieldName 283

OnActiveChange 283
OnDataChange 283
OnEditingChange 283
OnUpdateData 283
TFloatField 265
TFontDialog 251
251
Device 251
Font 251
MaxFontSize 251
MinFontSize 251
Options 251
251
On Apply 251
OnClose 251
OnShow 251
TForm 287, 289, 429
289
Close 289
CloseQuery 289
FocusControl 289
GetFormlmage 289
Hide 289
Print 289
Release 289
Show 289
ShowModal 289
287, 288
Active 288
ActiveControl 287
ActiveMDIChild 288
AutoScroll 287
AutoSize 287
Borderlcons 287
BorderStyle 287, 288
BorderWidth 287
Canvas 288
Caption 287
ClientHeight 287
ClientWidth 287
Color 287


TForm ()

Constraints 287
Ctl3D 287
Cursor 287
FormStyle 287
Height 287
Icon 287
Left 287
MDIChildCount 288
MDIChildren 288
Menu 287
ModalResult 288
Name 287
PopupMenu 287
Tag 287
Top 287
Visible 287
Width 287
WindowState 287
289
OnActivate 289
OnClick 289
OnClose 289
OnCloseQuery 289
OnCreate 289
OnDblClick 289
OnDeactivate 289
OnDestroy 289
OnKeyPress 289
OnMouseDown 289
OnMouseMove 289
OnMouseUp 289
OnPaint 289
OnShow 289
TFrames 291
TGraphic 248
TGraphicControl 273
TGraphicField 265
TGridDataLink 282
TGroupBox 244
TImage 247
247
AutoSize 247
Center 247
Picture 247
Stretch 247
TIME 125
TIMESTAMP 125
TIntegerField 265
Tlabel 239

Alignment 240
Autosize 240
Layout 240
Transparent 240
Wordwrap 240

677


TLargeField 265
TListBox 246
246
Columns 246
Itemlndex 246
Items 246
MultiSelect 246
SelCount 247
Selected 247
Sorted 247
TListSourceLink 282
TMainMenu 416
416
416
AutoHotkeys 416
AutoMerge 416
Images 416
OwnerDraw 416
TMasterDataLink 282
TMemo 246, 269

Alignment 246
CaretPos 246
Lines 246
TMemoField 265, 269
TMenuItem 416, 417, 422, 423
418
Add 418
Clear 418
Click 418
Find 418
IndexOf 418
InsertNewLineAfter 418
InsertNewLineBefore 418
IsLine 418
Remove 418
417
Action 417
Bitmap 417
Break 417
Caption 417
Checked 417
Default 417
Enabled 417
Grouplndex 417
Imagelndex 417
Menu Index 417
Radioltem 417
Shortcut 417
418
OnAdvancedDrawItem 418
OnClick 418
OnDrawItem 418
OnMeasureltem 418
TNavDataLink 282
TObject 203
TOLEServer 518

TOpenDialog 249
TOpenPictureDialog 249
TPageControl 305
305
ActivePage 305
ActivePagelndex 305
HotTrack 305
MultiLine 305
PageCount 305
Pages 305
Style 305
TPagcProduce 640, 643
640
Content 640
640
OnHTMLTag 640
TpageProducer
640
HTMLDoc 640
HTMLFile 640
TPanel 244

Bevellnner 244
BevclOuter 244
TPicture 247
248
LoadFromClipboardFormat 248
LoadFromFile 248
SaveToClipboardFormat 248
SaveToFile 248

Bitmap 248
Height 247
Icon 248
Metafile 248
Width 247
TPopupMenu 423
TPowerPointApplication 547
TPowerPointPresentation 547
TPowerPointSlide 547
TPrintDialog 252
252
Collate 252
Copies 252
FromPage 252
MaxPage 252
MinPage 252
Options 252
PrintRange 252
PrintToFiie 252
ToPage 252
TPrinterSetupDialog 252
TQRBand 359, 373
360
AddPrintable 360

678
TQRBand ()
360
AlignToBottom 360
BandType 360
Font 360
Frame 360
HasChild 360
Size 360
360
AfterPrint 360
BeforePrint 360
TQRChart 404, 410, 412
TQRCSVFilter 363
TQRDBImage 361
TQRDBRichEdit 360
TQRDBText 360
TQRExcelFilter 363
TQRExpr 361

Reset AfterPrint 361


TQRExprMemo 362
TQRFrame 376
376
Color 376
DrawBottom 376
DrawLeft 376
DrawRight 376
DrawTop 376
Style 376
Width 376
TQRGroup 373
TQRHTMLFilter 363
TQRImage 362
TQRLabcl 362
TQRMemo 362
TQRRichText 362
TQRRTFFilter 363
TQRShape 362, 376
TQRSysData 363, 369
TQRTextFilter 363
TQRWMFFiltcr 363
TQuckRep 355
TQuery 253, 254, 259, 313, 348, 381,
385, 648, 661
313
ExecSQL 313
ParamByName 313
Prepare 314
UnPrcpare 314
313
Constrained 314
DataSource 314
ParamCheck 314
ParamCount 314
Params 314


TQuery ()

Prepared 314
Rows Affected 314
SQL 314
Text 314
TQueryTableProducer 643, 648
TQUickRep 359
TQuickRep 355, 358, 363, 364
357
ExportToFilter 357
NewPage 357
Prepare 357
Preview 357
Print 357
PrinterSetup 357
356
Bands 356
DataSet 356
Description 356
ExportFilter 356
Exporting 356
Options 356
Page 356
ShowProgress 356
Units 356
Zoom 356
357
AfterPreview 357
AfterPrint 357
BeforePrint 357
OnEndPage 358
OnStartPage 358
TQuickReport 356
TRadioButton 242, 425

Caption 242
Checked 242

OnClick 242
try... except 211
try... finally 211
TSaveDialog 249
TSavePictureDialog 249
TSmalllntFicld 265
TStatusBar 446
TStatusPanel 447
447
Bevel 447
Style 447
Text 447
Width 447
TStoredProc 313
TStringField 265
TSvsData 364

679


253, 254, 259, 313, 661
255
Addlndex 255
ApplyRange 255
Cancel 255
CancelRange 255
DeleteTable 255
Edit 255
EditKey 255
EditRangeEnd 255
EditRangeStart 255
EmptyTable 255
FieldByName 255
Find Key 255
FindNearest 255
First 255
GotoKey 255
GotoNearest 255
Insert 255
Last 255
Locate 255
LockTable 255
MoveBy 255
Next 255
Post 255
Prior 255
RenameTable 255
SetKey 255
Set Range 255
SetRangeEnd 255
SetRangeStart 255
UnlockTable 255
254
Active 254
BOF 254
DatabaseName 254
Defaultlndex 254
EOF 254
Exclusive 254
Exists 254
FieldCount 254
Fields 254
IndexDefs 254
IndexFieldCount 254
IndexFieldNames 254
IndexFields 254
IndexFiles 254
IndexName 254
KeyExclusive 254
KeyFieldCount 254
MasterFields 254
MasterSource 254
Modified 254
Readonly 254
RecordCount 254
TableLevel 254
TableName 254
TableType 254

()
258
AfterCancel 258
AfterClose 258
AfterDelete 258
AfterEdit 258
Afterlnsert 258
AfterOpen 258
AfterPost 258
AfterScroll 258
BeforeCancel 258
BeforeClose 258
BeforeDelete 258
BeforeEdit 258
Beforelnsert 258
BeforeOpen 258
BeforePost 258
BcforeScroll 258
OnCalcFields 259
OnNewRccord 259
TTabSheet 306
TToolBar 423-426
423
ButtonHeight 423
Button Width 423
Disabled I in ages 423
Flat 423
Hotlmages 423
Images 423
. Indent 423
List 423
ShowCaptions 423
Transparent 423
Wrapable 423
424
OnDockDrop 424
OnDockOver 424
OnDragDrop 424
OnDragOver 424
OnEndDock 424
OnEndDrag 424
OnStartDock 424
OnStartDrag 424
TToolButton 424, 425
425
CheckMenuDropdown 425
Click 425
424
Action 424
AllowAHUp 424
AutoSize 424
Caption 424
Down 424
DropdownMenu 424
Grouped 424
Hint 424
Imagelndex 424

680
TToolButton ()

Indeterminate 424
Marked 424
Menultem 424
ShowHint 424
Style 424
425
TTypedCOMObject 578
TTypedComObject 559
TWebModule 633, 637, 639
634
Action 634
635
AfterDispatch 635
BeforeDispatch 635, 636
OnCreate 635, 636
OnDestroy 635, 636
TWebRequest 634
TwebRequest
634, 635
Content 634
ContentFields 634
Method 635
Query 635
QueryFields 635
RemoteAddr 635
TWebResponse 635
635
Content 635
ContentLength 635
ContentStream 635
ContentType 635
TWinControl 273
TWordApplication 520, 522
TWordDocument 524
TWordField 265
Type 176, 177

Unassigned 188
UNION 343, 344
UNION ALL 343, 344
UNIQUE 128, 130, 326
unit 198, 199
UPDATE 143, 145, 146, 148
UPDATE OF 134
URL 601, 602
uses 176, 198, 199

Var 177
VarArrayCreate 188
VarArrayLock 190
VarArrayOf 189
VarArrayRedim 190
VARCHAR 124


variant 188
VarType 188
VBA 515, 520, 527
VCL 235, 237
virtual 207
Visual Basic 63, 215
Visual Basic for Application 515, 520
Visual Component Library 235
VMT 207

w
web- 604, 608
web- 603
web- 596, 602-604, 657
web- 604, 606
web- 602-604, 607, 616,
620, 622, 623, 650
629
CONTENT_LENGTH 629
PATH_INFO 630
QUERY_STRING 628
REMOTE_ADDR 630
REMOTE_HOST 630
REQUEST_METHOD 630
SERVER_NAME 630
S E R V E R P O R T 630
SERVER_PROTOCOL 630
web- 603
603
603
WHERE 146, 147, 321, 335
while ...do 192
WideChar 180
WideString 183
WinCGI 618
WinHelp 447, 477
WITH GRANT OPTION 149, 150
Word 179
WordApplication 518, 520
WordBasic 515
WordBool 180
Workbook 538
538
Activate 538
Save 538
SaveAs 539
538
ActiveSheet 538
Sheets 538
Worksheets 538
Workbooks 535, 536, 538, 549
536
Add 536
Close 537
Item 538
Open 537
538
Count 538


Worksheet 539, 543
541
.Activate 541
540
Cells 540
Columns 540
Range 541
Rows 540
Worksheets 539, 543
write 205, 206
WWW- 602, 622

A
URL- 613
510, 576
617

116
116
116

- 28, 30, 32, 33, 70


- 30, 31
101, 103, 108

91, 512
235
557
515, 516, 577
485, 505
602
66

186
178, 188
156
485, 487, 507

124, 125

124
63
66
63
63
63

576, 585
341
131, 133, 134
553, 559, 572, 576, 586
415, 444
264

681

613
, 308
554
436, 437
437
334
373


124
124, 125
32
181, 182
422
59
209
117
380, 381
- 153
181
439, 440
101-103, 600
600
600
581


38, 44, 47, 59, 60, 64, 71, 73, 171
46
48
46
45
45
45
45
44, 47
47
48
48
48
94
93, 94

3
175
182, 185
135

554
116
383, 387

682
247
515
112, 113
136
136
137

136, 137
136
62, 201, 202, 215, 216
233
214, 217
596
- 596, 622
/- 30, 35
510, 559
510, 576, 577
414, 415
620
- 26
620
24, 25, 35, 37, 58,
61, 64, 68
28
24, 26, 28, 34, 38, 45
25
35
36
37
37
37

37
36
, , 36
36
28
33
30
- 29, 30
484
380
35, 36, 58
211
61
55

104
134
110
416, 419
419
182, 186, 200

- 573
511
552


513
101, 104
107
108
107
105
105
105, 117
107
105
105
105
105
237
98, 100, 101

484
156

442
441
247

441
456
586, 587
57
213, 217

ADO 259
Decision Cube 385, 386
Delphi 219, 235
236
236
TeeChart 404
VCL 428
HTML 640
- 518-520
519
Connect 519
ConnectTo 520
Disconnect 520
518
AutoConnect; Boolean 518
AutoQuit: Boolean 518
ConnectKind: TConnectKind 518
RemoteMachineName 519
26, 27
177
- 178
209
- 443
422
577
599
152, 157, 159, 168
- 152
152

683


68
101, 103, 106

34
30, 34
30
180
197
553

WinHelp 450
ALink 450
AppendMenu 450
BrowseButtons 450
ControlPanel 450
CreateButton 450
ExecFile 450
Find 450
InscrtMenu 450
KLink 450
MPrintID 450
ShellExecute 450
Shortcut 450
143
598
598
182, 183
184
183

486
222, 437
414, 415
416
420
420
421
418
420
176, 192
GET 605, 628, 639, 657
POST 605, 628, 629, 632, 639, 657
Oracle CDM 69, 71-73
RAD 60, 61, 66, 67, 68
64

64
67
66
65
60
207
208
207

()
207
209
207
200
286
183
383
28, 30, 33, 34, 35
597

597, 598
597, 599
597, 599
597, 598
LLC 598
MAC 598
182, 185
286
49
49, 51
52, 54
54
51
53
49
52
54
49, 55
55

552, 586
75, 77
- 153
176, 198

199
199
199
199
199
266, 662
104

253, 257
239
99, 201, 203, 215, 216
118, 119
286
516
115
117
117, 118
117
117
117
117, 119
117

684

210
210
210
210
210
210

490
216
64, 234
342
62, 64, 201

554, 557, 565, 569, 570, 572, 574, 580


511, 514, 516, 580, 581, 585
126
99
- 174
-
25, 62, 63, 174, 199
61, 62
-
62
99, 100
200
201
128
CHECK 128, 134
NOT NULL 128-130
UNIQUE 128, 130, 131
128, 131-133
128, 129
108
108, 126
286
248, 250
249
Execute 249
249
DefaultExt 249
FileEditStyle 249
FileName 249
Files 249
Filter 249
Filter-Index 249
HistorvList 249
InitialDir 249
Options 249
Title 249
249
OnClose 249
OnCloseQuery 249
OnFolderChange 249
OnSelectionChange 249
OnShow 249
OnTypeChange 249
250

break 193
case... of 191
continue 193
if 191
190
190

Object Pascal 190


192
30
82
196, 197
URL- 609, 613

111
101
353
354
29, 30

235, 438, 596, 597


235
235
414, 415, 423
194
- 196
- 196
64
195
195
195
242

383
448
380, 381
383
381
209
177
364
APPNAME 364
APPSTARTDATE 364
APPSTARTTIME 364
COLUMNNUMBER 364
PAGENUMBER 364
REPORTTITLE 364
180
414
57
341
556
, 308
207, 513, 514, 585
262

685


99, 201, 204, 215, 216

ColumnHeader 368
GroupFooter 374
GroupHeader 373
PageFooter 369
Summary 370
Title 367
PageHeader 369
355, 359
ColumnHeader 359
Detail 359
GroupFooter 359
GroupHeader 359
PageFooter 359
PageHeader 359
SubDetail 359
Summary 359
Title 359
186
200, 204
601
179
62, 106, 152
137
345
138
139
140
147
147, 148
147
30, 33, 34
ASP 650-652
Object Pascal 175
39
41
438
39
40
- 40
Delphi 428
430
432
429
432
431
429

44
203

114
178
596, 597
FTP 600, 601
HTTP 600-602, 604, 622, 624

()
207
IP 596, 597, 599
POP 600
SMTP 601
TCP 599
T C P / I P 599
WAL 94
SMTP 600
61-63, 65, 66, 156

68
82
86
194
- 174
332
602

513, 516-518
ISAPI 618
234
234
112
32, 100, 101, 151
112
90, 98, 99
100, 106, 110
155, 156
131
131, 134

93
93
93, 94
93, 94
93
205
206
206
206
206
200, 201
110
110

110

107
191
152

553
OLE Automation 652

686
{)
511, 513, 576, 578
511
32
28, 33, 34, 35
34, 35

123, 124
123
179

60
53
60, 63, 91
28, 32

485
29
29
64
64
448
340
338
338
201
372

558
552
193

342
114
257
ISAPI 618
246
443
214
RAD 62, 484

60, 213

62, 63, 213, 214
487
30
64, 134

ISO/IEC 12207 44
ISO/IEC 12207 48
ISO/IEC 12207 1995-08-01 73
ISO/IEC 12207 1995-08-01 69
34 77, 79
34 69

69
68
68


103
AAA, AAG
182
182
176, 178, 182

91
91
105

103
103
603

207
207
MS Word 531

354
299
609, 611
613
611
BODY 609
BR 611
FORM 614
FRAMESET 610
HEAD 609
I 611
INPUT 614, 615
LI 611
LINK 610
OL 611
P 610
U 611
UL 611
243

448
450, 467
451
456
456
452
452
59
101
265
176
SQL/92 123
123, 125
123
123, 124

687

92
92
34
64, 70, 122, 142
142
143

553
448
178, 187
115
601

147
149
61
126
39
121
92
190
92

557

41
43
42
43
43
42
30, 34
186
182
195
168, 170
67
241
194, 196
237, 286, 434
HTML 614
295
305
434
290
197
332
117


119
26, 27

505
219, 485, 488
33, 34, 70, 140, 141
141
141
141
142

29, 108, 109


109
109
124
179

for ...do 192


repeat...until 193
whilc.do 192

4
202

201
ActiveX 585, 586, 589, 590
ActiveX 587

HTML 604, 608


QBE 98, 121
QUEL 121
SQL 32, 95, 98, 121, 254, 312, 313, 318
123
122
122
122
123
123
122
143
562
95
95
95



.
.
.
.
.
. , .
.
. -

05784 07.09.01.
04.10.02. 70x1007,,..
. . . 55,47. . 4000 . 1538.
.
196105, -, . , . 67.
-
005-93, 2; 953005 - .
. . .
, .
197110, -, ., 15.

Вам также может понравиться