[Lazarus] TPageControl - how to use it?

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Jan 29 10:41:35 CET 2012


On Sun, 29 Jan 2012 00:03:48 +0000
Howard Page-Clark <hdpc at talktalk.net> wrote:

> 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.

I added a note to TWinControl.Parent.

Mattias




More information about the Lazarus mailing list