Setting a TLabel caption during OnCreate can effect form auto-position.
Original Reporter info from Mantis: PaulFMichell
-
Reporter name: Paul Michell
Original Reporter info from Mantis: PaulFMichell
- Reporter name: Paul Michell
Description:
In Laz 1.7 (SVN) creating a label control as the child of a panel in code, then setting it's caption property can interfere with the form's automatic positioning.
It only occurs when the label is a child control of a panel. When the application runs, the form is offset to the right and down. This does not happen in Lazarus 1.6RC2, only in 1.7 SVN (both built with FPC 3.1.1).
Steps to reproduce:
Create a blank project and set Form1.Position to poScreenCenter
Then add an FormCreate event handler like this:
procedure TForm1.FormCreate(Sender: TObject);
var
BlankPanel: TPanel;
begin
BlankPanel := TPanel.Create(Form1);
with TLabel.Create(BlankPanel) do
begin
Align := alLeft;
Alignment := taRightJustify;
AutoSize := False;
Caption := 'TEST';
Layout := tlCenter;
Parent := BlankPanel;
end;
BlankPanel.Align := alTop;
BlankPanel.AutoSize:=True;
BlankPanel.Parent := Form1;
end;
Additional information:
Version Info: Lazarus 1.7 r51497M FPC 3.1.1 x86_64-linux-gtk 2
Sample project attached.
Mantis conversion info:
- Mantis ID: 29589
- OS: Kubuntu
- OS Build: 15.10 64 bit
- Build: Lazarus Trunk
- Platform: Linux GTK2
- Fixed in revision: 51664 (#08fa33a8)