S
S
Squonchy2016-10-13 23:12:09
Delphi
Squonchy, 2016-10-13 23:12:09

How to write procedures to dynamically created objects in Delphi?

Имеется массив из динамически созданных КомбоБоксов. Как сделать так, чтобы при выборе определенных элементов из КомбоБокса происходило какое-либо действие (например ShowMessage)
procedure TForm1.Button2Click(Sender: TObject);
begin
k := k + 1;
Day[n]:= TComboBox.Create(Form1);
Day[n].Parent:= Form1;
Day[n].Left:=50;
Day[n].Top:=50 * k;
Day[n].Width:=50;
Day[n].Style := csDropDownList;
for I := 1 to 31 do
Day[n].Items.Add(IntToStr(I));
n := n + 1;
end;
procedure TForm1.Day[0]Change(Sender: TObject);
begin
if Day[0].Text = '29' ShowMessage('!!!');
end;

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rou1997, 2016-10-13
@Rou1997

https://www.google.ru/search?q=delphi+set+event+ha...

A
Alex, 2016-10-14
@streetflush

Day[n].onChange:=DayChange;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question