1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
unit Unit5;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TForm5 = class(TForm)
ComboBox1: TComboBox;
procedure FormCreate(Sender: TObject);
procedure ComboBox1Click(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
var
Elements: array[0..2] of integer = (1, 2, 3);
procedure TForm5.ComboBox1Click(Sender: TObject);
begin
ShowMessage(IntToStr(Elements[ComboBox1.ItemIndex]));
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
inherited;
ComboBox1.OnClick := nil;
ComboBox1.Style := csDropDownList;
ComboBox1.Items.Add('Lundi');
ComboBox1.Items.Add('Mardi');
ComboBox1.Items.Add('Mercredi');
ComboBox1.ItemIndex := 0;
ComboBox1.OnClick := ComboBox1Click;
end;
end. |
Partager