: , , , , . . , , . . :
- DFM, . ' , .
- PAS, Delphi. , .
- DPR, . . Delphi .
Delphi ( 1.7.1):
. 1.7.1. Delphi
. .
', Delphi? , . , DFM, . DFM - , . ʳ DFM - . , , DFM - Unit1.DFM.
DFM -, View as Text ( 1.7.2).
. 1.7.2. View as Text
Delphi :
object Form1: TForm1 Left = 250 Top = 150 Width = 400 Height = 303 Caption = Weight Calculator Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = MS Sans Serif Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 64 Top = 48 Width = 93 Height = 13 Caption = Specify your height: end object Label2: TLabel Left = 64 Top = 144 Width = 84 Height = 13 Caption = Your ideal weight: end object Button1: TButton Left = 248 Top = 64 Width = 75 Height = 25 Caption = Compute TabOrder = 0 OnClick = Button1Click end object Button2: TButton Left = 248 Top = 160 Width = 75 Height = 25 Caption = Close TabOrder = 1 end object Edit1: TEdit Left = 64 Top = 64 Width = 121 Height = 21 TabOrder = 2 end object Edit2: TEdit Left = 64 Top = 160 Width = 121 Height = 21 TabOrder = 3 end end |
, . Form1 Button1, Button2, Edit1, Edit2, Label1, Label2. , , . , , . View as Form ( 1.7.3).
|
|
a)
b)
. 1.7.3. View as Form
' . - , ' .
(DFM -) . DFM - ( ). , . , .
1.7.3.
(unit), ' , Delphi. PAS. . ? , , , , . , , ' .
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Edit1: TEdit; Memo1: TMemo; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin // Memo1.Lines.Add(IntToStr(StrToInt(Edit1.Text) 100)); end; procedure TForm1.Button2Click(Sender: TObject); begin Close; end; end. |
. unit '
unitUnit1; |
ͳ ' . Delphi , ' ' , , ', File/Save As. Delphi unit '. ϳ .
(interface) VCL, .
|
|
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; |
Delphi , . , ().
(type) . TForm1 TForm.
type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Edit1: TEdit; Memo1: TMemo; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; |
. , . , .
ϳ . Delphi 䳿. , Button1 䳿 OnClick Button1Click.
, , , published (³ TForm). , , . Delphi published, ͳ ( ), : . ':
- , Delphi , , ;
- , Delphi , , Delphi .
private public, - , . Delphi " ", . private , , public , .
ϳ ' :
var Form1: TForm1; |
Form1 ' TForm1, DPR - (. ).
(implementation). :
{$R *.dfm} |
, , DFM. ϳ DFM -, . ' DFM - ' , .
. Delphi . [1].
procedure TForm1.Button1Click(Sender: TObject);begin// Memo1.Lines.Add(IntToStr(StrToInt(Edit1.Text) 100));end; procedure TForm1.Button2Click(Sender: TObject); begin Close; end; |
' : Button1Click Button2Click , . . DFM -. .
|
|
object Button1: TButton OnClick = Button1Click end object Button2: TButton OnClick = Button2Click end |
' . , , , 䳿 Delphi , . , , .
, , . , DPR (. Delphi Project). ³ Delphi, uses , . DPR -.
File/New/Application , Delphi . . , DPR - , . DPR - , , Delphi Project/View Source. ' :
program Project1; uses Forms, Unit1 in Unit1.pas {Form1}; {$R *.res} Begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end. |
. 1.7.3.1
. ϳ Forms ' , ' Application. ' - .
ϳ Unit1 . . in , Delphi.
{$R *. res} , . .
, ' Application. Initialize , CreateForm Form1, Run . Run . Run , ; [2].
1.7.5.
. :
- DOF (. Delphi Options File), ;
- DSK (. . Desktop), Delphi . Delphi DSK -, Tools/Environment Options Environment Options Preferences Autosave options Project Desktop.
- CFG (. . Configuration), .
- DCI (. . Delphi CodeInsight), Delphi "" (CodeInsight).
- DCT (. . Delphi Component Templates), .
- DMT (. . Delphi Menu Templates), .
- DRO, .
- TODO .
- DDP (. . Delphi Diagram Portfolio), , ' .
- RES (. RESource). , , , . , , .
: (BMP -), (ICO -), (HLP, CHM -) .., .
|
|
, ( 1.7.4):
. 1.7.4. Delphi
. 1.7.5. .
, . ', , , , .
'- ', [3], , , , . '- . ϳ , ' , , , , , , , , .
'- :
OO , , -. ' () () /() , , ' , . ʳ , / '.
, . OO "", , , . , , .
OO . (, ' ), ( , ). : .
OO . ' , . ' , . , , .
, OO , . , , . .
. , , .
'-
OO , :
OO
OO
ᒺ
. , ᒺ- , ᒺ ᒺ- , ᒺ.
|
|
ᒺ . , ᒺ , , , . , ᒺ .
ᒺ- , ; , .
2.1. ᒺ- .
ᒺ- (object-oriented programming, OOP)? :
ᒺ- - , ᒺ, , .
:
1) OO ᒺ, ;
2) ᒺ ;
3) .
ᒺ- . , , OO, .
ᒺ-. ᒺ- , , Pascal COBOL , . : " ᒺ- , :
- ϳ ᒺ, , , .
- ᒺ ().
- () ()".
ᒺ- = + +
2.2. ᒺ- .
쳺 . , , . ᒺ- :
ᒺ- - , ᒺ ᒺ , .
: ᒺ- 1) ᒺ- ; 2) , ( ᒺ) ( ) , .
ᒺ- ᒺ- ; ᒺ, - . OOD (object-oriented design), ᒺ- .
2.3. ᒺ- .
ᒺ . ᒺ- ( OOA, object-oriented analysis) ᒺ- .
ᒺ- - , ᒺ, (-) .
, OOD OOP? , OOD; OOD 㳿 OOP.
2.4. ᒺ
, :
∙ - | |
∙ ᒺ- | ᒺ |
∙ - | , |
∙ | "-" |
∙ |
. . ᒺ- - ᒺ . :
- ;
- ;
- ;
- .
ֳ , ᒺ-. , :
- ;
- ;
- .
, , ᒺ , .
:
1. Delphi.
2. (*.pas).
3. .
4. .
5. .
6. .
˳:
.. Delphi. Delphi. 2006 . - 1152 .
2. .. Delphi 2006. : Delphi, , Win32 .NET, 2006 . - 1152 .