[Lazarus] TPageControl - how to use it?
Howard Page-Clark
hdpc at talktalk.net
Sat Jan 28 21:13:34 CET 2012
On 28/1/12 7:50, Bernd wrote:
> I have a TPageControl on my form and at runtime I
> want to add a new page with a SynEdit on it.
>
> This is what I have so far:
> ...
> But it does not work.
Try this:
procedure TForm1.AddTab(AFileName: String);
var
Sheet: TTabSheet;
Ed: TSynEdit;
begin
Sheet := TTabSheet.Create(pagecontrol1);
sheet.Parent := PageControl1;
Sheet.Caption := 'Unnamed';
Ed := TSynEdit.Create(Sheet);
ed.Parent := Sheet;
ed.BoundsRect := sheet.BoundsRect;
ed.LineText := 'specimen line';
PageControl1.ActivePage := Sheet;
end;
More information about the Lazarus
mailing list