: TListBox TComboBox. .
5.1.
ShortString String[N]
. ShortString 255 . String[N] N , 255. .
String
() . 4 , , . .
.
WideString
, OLE-. String , , .
- Phar
, #0. . - API- Windows (API - Application Program Interface - ).
. , PChar.
Var
MasS: array[1..100] of Char;
- .
TlistBox
TListBox , . Items, Add, Delete Insert , . Items (TString) , . ItemIndex.
5.3. TcomboBox
TComboBox TListBox TEdit, . Text TEdit, - Items TListBox. . , Style. csSimple , .
TbitBtn
|
|
TBitBtn Additonal Tbotton. - , Clyph. , Kind, 11 . , bkCustom bkHelp mr*** ( bkOk - mrOk). bkClose npo.
5.5.
, , . ., Windows . DELPHI . Events .
. , Events, () . DELPHI .
, . . 5.1.
5.1
OnActivate | |
OnCreate | ( TForm). , , |
OnKey Press | . Key Char ASCII- ( Enter #13, Esc - #27 ..). , |
OnKeyDown | . Shift, Alt Ctrl, . Key, Word |
OnKeyUp | OnKeyDown |
OnClick | |
OnDblClick |
5.6.
: . . mb. Enter. Close.
(.5.1). .
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TUnit_Lab5 = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
BitBtn1: TBitBtn;
Button1: TButton;
Procedure FormActivate(Sender: TObject);
|
|
Procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);
Procedure ComboBox1Click(Sender: TObject);
Private
{ Private declarations }
Public
{ Public declarations }
end;
var
Unit_Lab5: TUnit_Lab5;
Implementation
{$R *.DFM}
//
Procedure TUnit_Lab5.FormActivate(Sender: TObject);
begin
ComboBox1.SetFocus; // ComboBox1
end;
//
Procedure TUnit_Lab5.ComboBox1KeyPress(Sender: TObject; var Key: Char);
begin
if Key =#13 then // Enter ...
begin
// a
ComboBox1.Items.Add(ComboBox1.Text);
ComboBox1.Text:= ''; //
end;
end;
Procedure TUnit_Lab5.ComboBox1Click(Sender: TObject);
var
St: string;
n, i, nst, ind: integer;
begin
n:= 0; // //
ind:= 0;
//
nSt:= ComboBox1.ItemIndex;
// st
St:= ComboBox1.Items[nst];
// st
for i:= 1 to Length(St) do
begin
Case ind of
0: if St[i] <>'' then
begin
//
//
ind:= 1;
n:= n+1;
end;
//
1: if St[i] ='' then ind:= 0;
end;
end;
Label3.Caption:= IntToStr(n); // Label3
end;
end.
B TEdit TListBox Text Items Enter. Close. .
1. , . . .
2. , . .
3. , . .
4. , . .
5. , . .
6. , , , , , +, -. , (.. + - , ).
7. , , , , , +" "-". , .
8. , , , , , + "-''. , .
9. , , . .
10. , , . .
11. , , . , .
12. , , . , k - ( k - , ).
13. , , . , k ( k - , , k ).
|
|
14. , , . , .
15. , , . .
16. , , . .
17. , , . k , .
18. , , . i- j- .
19. , , . .
20. , , . .
21. S1 S2 Sm , , "" "+", "-". , S1 . , . , . , : , .
22. , . , .. ( k ) .
23. , . .
24. , . , , , .. , (, ).
25. , ( ) Pascal, .
26. , ( ) Pascal, begin end .
27. , 1 1999 .
28. . , 1 999, , , .
29. k . , .
30. k . , .
6.