[Lazarus] TPageControl - how to use it?
Bernd
prof7bit at googlemail.com
Sat Jan 28 20:50:21 CET 2012
There is documentation about how to add tabs and controls in the
designer but I could not find any explanation of how to do the same
programatically. 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:
procedure TForm1.AddTab(AFileName: String);
var
Sheet: TTabSheet;
Ed: TSynEdit;
begin
Sheet := PageControl.AddTabSheet;
Sheet.Caption := 'Unnamed';
Ed := TSynEdit.Create(Sheet);
end;
But it does not work. It will add a new Tab and set its caption but
the tab will be empty. I have tried Ed.Show and also tried to change
its position and size but nothing helps. I also tried with a simple
TButton instead of a TSynEdit but this also does not work. What am I
missing here?
Bernd
More information about the Lazarus
mailing list