[Lazarus] TPageControl - how to use it?

Howard Page-Clark hdpc at talktalk.net
Sun Jan 29 01:03:48 CET 2012


On 28/1/12 9:00, Mattias Gaertner wrote:
> Hint:
> You don't need the Delphism "set Parent first" under LCL. The above will
> create a lot of updates.
>
> procedure TForm1.AddTab(AFileName: String);
> var
>    Sheet: TTabSheet;
>    Ed: TSynEdit;
> begin
>    Sheet := TTabSheet.Create(pagecontrol1);
>    Sheet.Caption := 'Unnamed';
>    Ed := TSynEdit.Create(Sheet);
>    ed.Align := alClient; // fill the whole sheet
>    ed.LineText := 'specimen line';
>    ed.Parent := Sheet;
>    PageControl1.ActivePage := Sheet;
>    sheet.Parent := PageControl1; // set Parent as last to reduce updates
> end;

Thanks for the hint. I would not have known that from reading the wiki - 
I think it is worth documenting there somewhere.




More information about the Lazarus mailing list