TLabel kills TPanel::Align


2004-07-08 08:18:19 PM
cppbuilder112
Hi,
I experience strange behaviour when settings the caption of 1 TLabel. When I
do this in the FormShow, the TPanel doesn't Align itself anymore. When I set
the caption of another (second) TLabel, the TPanel does align ok?
Can anyone explain this?
Here's the programs setup:
MainForm has a TPanel (Panel1) and a TButton.
Form1 has a TPanel (Align=alClient) and 2 TLabels.
Hitting the button on the MainForm, the application does:
Form1->Parent=Panel1;
Form1->Align=alClient;
Form1->Show();
Now in Form1::FormShow() if I set caption of Label1 to something, the
Form1::TPanel doesn't align anymore.
//case 1: this makes the TPanel *not* align
TForm1::FormShow
{
Label1->Caption="something";
}
//case 2: this works fine
TForm1::FormShow()
{
Label1->Caption="something";
Label2->Caption="something";
}
//case 3: this works fine
TForm1::FormShow()
{
}
Very strange not?
Debugging I've noticed that following events occur:
Case 1: (error)
Panel::Resize
Form::Resize
Panel:ConstrainedResize
Panel:ConstrainedResize
Form::Resize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel:ConstrainedResize
Case 2: (ok)
Panel::Resize
Form::Resize
Panel:ConstrainedResize
Panel::CanResize
Panel:ConstrainedResize
Panel::CanResize
Panel:ConstrainedResize
Panel::Resize
Form::Resize
Panel:ConstrainedResize
Case 3: (ok)
Panel::Resize
Form::Resize
Panel:ConstrainedResize
Panel:ConstrainedResize
Form::Resize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel::CanResize
Panel:ConstrainedResize
Panel::CanResize
Panel::Resize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel:ConstrainedResize
Panel:ConstrainedResize