2. Delphi
Windows - , .. . , , , Windows , , . . , , - . , Windows , . Delphi , Windows , Delphi . , . , .
. Edit1. "" . : : Properties () Events (). Events. , . , , . , .
, . Edit1 Text - ! , onChange (change - (.)), . :
1. onChange, .
2. Caption Label1 Text Edit1, , : Label1.Caption:= Edit1.Text; .
3. , . , .
onClick, . , . Text . Delphi ( ): ' Delphi '. , - : ''. , : Edit1.Text:=''; , Edit, Clear ( .): Edit1.Clear; , . . - , , ?! ! onEnter, , "" , onClick. , . :
|
|
- onChange
- onClick
- onEnter
, :
- onExit - , ;
- onDblClick - ;
- onKeyDown - ;
- onKeyUp - ;
- onKeyPress - . onKeyDown onKeyUp Key;
- onMouseDown - ;
- onMouseUp - ;
- onMouseMove -
- , onCreate. . , , , . , Width Height . , .. , onCreate:
Form1.Width:= 0;
Form1.Height:= 0;
, BorderStyle None. . "" . ,
Delphi. ,
, (). Delphi . , , .
Delphi . Ÿ () , , . .
- begin / end. implementation :
var
Form1: TForm1;
, , . , (Form1) ! Delphi: var _: _;
var - . , Delphi. , , :
var A, B, C: Integer;
, var :
var A, B: Integer; C, D: String;
. , : 3.1415 ' ', . , const, , . :
const pi = 3.1415;
ZnakPi: String = ' ';
, Pi Delphi, Delphi 3,1415... , Pi Real .
|
|
, Delphi. .
, : ' '
, : ' '' - '
, . . , .
- String. String 2 . , String , : String[50]. Char : 'a'. , , , ( #13), ( #10). ( ANSI), #. , #0.
, - . , 0 (#0). PChar.
. .
Integer | -2147483648.. +2147483647 |
Cardinal | 0.. 4294967295 |
Shortint | -128.. +127 |
Smallint | -32768.. +32767 |
Int64 | -263.. +263-1 |
Byte | 0.. +255 |
Word | 0.. +65535 |
Delphi Integer. , .
, . e ( E), , , 10 : 5e25 - .
. , , 0.
| Delphi Real. Double, . , Currency (), . |
Boolean, : True () False (). True > False.
, , , , , . , .
! Windows- - , Text Caption. , , Label Edit, Caption, . , Delphi , , . , ( ):
|
|
var A, B, C: Integer;
begin
A:= 5;
B:= 10;
C:= A+B;
Label1.Caption:= C;
end;
, Caption String, - Integer. , C . IntToStr. "", , : Label1.Caption:= IntToStr(C); , 15, . . Edit. Text . Edit, Label Button, . Edit1 Edit2 . , Button1. Delphi , begin end. :
procedure TForm1.Button1Click(Sender: TObject);
var A, B, C: Integer; //
begin
// :
A:= Edit1.Text;
B:= Edit2.Text;
C:= A+B;
Label1.Caption:= IntToStr(C);
//
end;
Delphi - A B Integer, Text - String. StrToInt, - . A B :
A:= StrToInt(Edit1.Text);
B:= StrToInt(Edit2.Text);
A, B, C . :
Label1.Caption:=IntToStr(StrToInt(Edit1.Text)+StrToInt(Edit2.Text));
, c (Float ing .) , Real. - FloatToStr, - StrToFloat.
, Delphi Real, "" . .