:






 

:

Quot;

"

 

: : . . . . . 107226, 6  
, : . .

 

 

- 2007


5

 

: TListBox TComboBox. .

: , , . .

 

:

unit lab5;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Buttons;

type

TForm1 = class(TForm)

BitBtn1: TBitBtn;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

ComboBox1: TComboBox;

procedure FormCreate(Sender: TObject);

procedure ComboBox1Click(Sender: TObject);

procedure ComboBox1KeyPress (Sender: TObject; var Key:char);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

ComboBox1.Items.Add('22 32 54');

ComboBox1.Items.Add('23 11 22');

ComboBox1.Items.Add('25 6 5 7 2');

ComboBox1.Items.Add('10 8 52 13');

ComboBox1.ItemIndex := 0;

ComboBox1Click(Sender);

end;

procedure TForm1.ComboBox1Click(Sender: TObject);

var

St:string;

i,j:integer;

buf:char;

begin

St := ComboBox1.Items[ComboBox1.ItemIndex];

For j := 1 to length(st)-1 do

For i := 1 to length(st)-1 do

If st[i]>st[i+1]

then

begin

buf:=St[i];

St[i]:=St[i+1];

St[i+1]:=buf;

end; Label3.Caption:= St;

end;

procedure TForm1.ComboBox1KeyPress (Sender: TObject; var Key:char);

begin

if Key=#13 then

begin

ComboBox1.Items.Add(ComboBox1.Text);

ComboBox1.Text:='';

end;

end;

end.

 

:

 

: TListBox TComboBox. .

 

<== | ==>
|

mylektsii.ru - - 2015-2018 . (0.008 .)