Hi!
Small demo attached.
Press the button 'Add new tTabSheet'. TabSheet on standart pagecontrol willbe added by next code:
procedure TForm1.Button1Click(Sender: TObject);
begin
with TTabSheet.Create(self) do begin
Visible:=True;
Caption:='Page '+inttostr(PageControl1.PageCount);
PageControl:=PageControl1;
end;
PageControl1.ActivePageIndex:=PageControl1.PageCount-1;
end;
Ok. No problems…
And now, press the 'Add new TsTabSheet' button with analogue code (for TsTabSheet):
procedure TForm1.Button2Click(Sender: TObject);
begin
with TsTabSheet.Create(self) do begin
Visible:=True;
Caption:='Page '+inttostr(sPageControl1.PageCount);
PageControl:=sPageControl1;
end;
sPageControl1.ActivePageIndex:=sPageControl1.PageCount-1;
end;
BUT!!! Access Violation on PageControl:=sPageControl1 string…
Why?