Tlist, populating and accessing objects


2003-10-01 08:20:07 PM
delphi141
Hi,
Can someone help me with following question ?
Suppose.
1) a masterpanel, which contains a picture, a checkbox and 2 labels.
2) I want to create this in runtime and put this in a tList.
Now,
3) How can and must I do this for example 30 masterpanels with all
sub-objects.
4) Suppose that I want all pictures react when clicking on that
picture ?
I tried this already for only the panel and changing the property
visible to false, but there I got problems when compiling.
var
arrPanel : tList;
i : integer;
begin
arrPanel := tList.create;
arrPanel.Clear;
arrPanel.Capacity := 30;
for i := 1 to 20 do
begin
arrPanel.add( tPanel.create(Self);
arrPanel.Items[ i ].Visible := FALSE;
end;
end;
Note, this is only a little example.
The purpose is, when changing the MasterPanel-visibility changes, all
child-object do so. I want to put then in a kind of an array, a list,
because all must execute the same thing, but in a dynamic way.
Thanks
Wim Vanmaele