Forum Discussion
I have the same problem: TLabel components are sorted first in property Controls [Index : integer] : TControl;
My code is like this:
TabSheet1 : TTabSheet (PageControl's TabSheet)
for I := 1 to 4 do
begin
L := TLabel.Create(Self);
L.Parent := TabSheet1;
L.Caption := 'test';
L.Left := 16;
L.Top := 16 + (I - 1) * 24;
L.Name := 'TLabel';
E := TEdit.Create(Self);
E.Parent := TabSheet1;
E.Text := 'Input here';
E.Left := 64;
E.Top := 16 + (I - 1) * 24;
E.Name := 'TEdit';
end;
and iteration in Controls like for I := 0 to ControlCount do ShowMessage (Controls [I].Name);
show four TLabel and then four TEdit controls.
Seems components of TControl are exported via Controls property before those of TWinControl, so I solved my problem when I've replaced TLabel with TStaticText. As far as I remember TWinControl uses more resources instead of TControl but my solved problem takes precedence :)
Related Content
Recent Discussions
- 5 hours agoSubhraDas