Hey, That is very simple.
In pascal script embended a class: TPageControl. That class is implemented the your tabs container. Tab implemented in TTabSheet class. So, the TPageControl and TTabSheet its all you need for create the you personal form with tabs for you script.
Code example:
Simba Code:
var
DsgnForm:TForm;
P: TPageControl;
Tab1,tab2: TTabSheet;
TButton0: TButton;
const
default = 'Comic Sans MS';
procedure YourClickProcedure(Sender: TObject);
begin
ShowMessage('click');
end;
procedure InitForm;
begin
//DsgnForm\\
DsgnForm:=TForm.Create(nil);
with DsgnForm do
begin
Caption:='DsgnForm';
Left:=0;
Top:=0;
Width:=420;
Height:=407;
Font.Name:=default;
Font.Color:=clDefault;
Font.Size:=0;
end;
P:=TPageControl.Create(DsgnForm);
with P do
begin
Parent:=DsgnForm;
Left:=0;
Top:=0;
Width:=420;
Height:=407;
end;
Tab1:=TTabSheet.Create(P);
with Tab1 do
begin
Caption:='Test1';
Left:=0;
Top:=0;
Width:=420;
Height:=407;
Visible:=true;
PageControl:=P;
end;
Tab2:=TTabSheet.Create(P);
with Tab2 do
begin
Caption:='Test2';
Left:=0;
Top:=0;
Width:=420;
Height:=407;
Visible:=true;
PageControl:=P;
end;
P.ActivePage := P.Pages[0];
P.ActivePage := P.Pages[1];
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
DsgnForm.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
begin
SafeInitForm;
SafeShowFormModal;
end.
Code is very simple, just look at that. If you need place any other control or TImage on your tab, you need assign to the control parent you tab index in TpageControl.Pages[youtabindex] property.
Example:
Simba Code:
TButton0:=TButton.Create(DsgnForm);
with TButton0 do
begin
Parent:=P.Pages[0];
Caption:='TButton0';
Left:=132;
Top:=154;
Width:=75;
Height:=25;
OnClick:=@YourClickProcedure;
end;
This is all. I hope this can help for anyone.
Cheers, Cynic.