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.

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to