On Fri, 5 May 2006 16:28:26 +0300
"Geno Roupsky" <[EMAIL PROTECTED]> wrote:
> A found that is all depends of weather the parent will be the form or a
> panel. Creating a new form, droping a panel in it and with this code for
> Form.OnCreate
>
> 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.
The OnClick event does not disable AutoSizing. It will create a lot of
overhead, because the properties will be executed immediately and therefore
depends on the order.
Put the Align assignments below the creation code in different order and you
will get different results.
This is not the case for the FormCreate code. Here the order does not
matter.
> 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.
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives