I would like to create a TTabsheet which has to be create during run time. The TTabSheet has several components, but all of these components will be identical on every tab. Is it possible to create a "type" variable which will create these tabs every time?
Thanks
Yes. You could create inherited class from TTabSheet
TCustomTabSheet = class(TTabSheet)
public
constructor Create(AOwner : TComponent); override;
public
FTestButton : TButton;
end;
constructor TCustomTabSheet.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
FTestButton := TButton.Create(Self);
FTestButton.Parent := Self;
FTestButton.Left := 1;
FTestButton.Top := 1;
FTestButton.Width := 20;
FTestButton.Heigth := 10;
FTestButton.Caption := 'Cool button!';
FTestButton.Name := 'TestButton';
end;
You could also create a frame (TFrame) with your custom controls in design time and host it instances to all new tabs.