I create the tabsheets dynamically in RunTime and placed a Frame inside it using this code:
procedure TForm1.Button2Click(Sender: TObject);
var
TabSheetG: TTabSheet;
begin
TabSheetG := TTabSheet.Create(PageControl1);
TabSheetG.Caption := 'Tab Sheet green ';
TabSheetG.PageControl := PageControl1;
Frame3 := TFrame3.Create(nil);
Frame3.Parent := TabSheetG;
Frame3.Show;
end;
and now i want to knew if the tab are already created and just make it activate it when i click the same button
Add a private variable of type
TTabSheetto your class.It will automatically be initialized to
nil.In the
OnClickevent handler, test whether the variable isnil. If not, create the tabsheet, otherwise, use the existing tabsheet.