frequently ask ? : Computers : Programming : Languages : Delphi

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

Delphi: Component: PageControl: How to create dynamically a PageControl + 1 tabsheet?

Apr 4th, 2006 16:36
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 04 April 2021 - 11:47 pm ----------------------
Delphi: Component: PageControl: How to create dynamically a 
PageControl + 1 tabsheet?
===
Steps: Overview:
 1. -E.g. using the program:
--- cut here: begin --------------------------------------------------
begin
  PageControl1 := TPageControl.Create( Self );
  PageControl1.Parent := Self;
  TabSheet1 := TTabSheet.Create( Self );
  TabSheet1.Caption := 'TabSheet1';
  TabSheet1.PageControl := PageControl1;
end;
--- cut here: end ----------------------------------------------------
 2. -All together:
--- cut here: begin --------------------------------------------------
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, 
Forms,
  Dialogs, StdCtrls, ComCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var PageControl1: TPageControl;
var TabSheet1: TTabSheet;
begin
  PageControl1 := TPageControl.Create( Self );
  PageControl1.Parent := Self;
  TabSheet1 := TTabSheet.Create( Self );
  TabSheet1.Caption := 'TabSheet1';
  TabSheet1.PageControl := PageControl1;
end;
end.
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
----------------------------------------------------------------------