procedure TForm1.FormCreate(Sender: TObject);
begin
with TButton.Create(Panel1) do
begin
Align := alRight;
Caption := '1';
Parent := Panel1;
end;
with TButton.Create(Panel1) do
begin
Align := alRight;
Caption := '2';
Parent := Panel1;
end;
with TButton.Create(Self) do
begin
Align := alRight;
Caption := '1';
Parent := Self;
end;
with TButton.Create(Self) do
begin
Align := alRight;
Caption := '2';
Parent := Self;
end;
end;
Clearly shows that both orders happen.
There is no significance of the order in whech the buttons will be created or the order in which the properties will be filled. But if the same code is executed for example in OnClick event it produces both 2-1 order which I consider is correct.
Based on that I think it has samething to do with the panel not yet shown or not entirely initialized.
This is tested with Delphi 7 under Windows XP.
--
Geno Roupsky
scr01.png
Description: PNG image
