From Clomosy Docs
function AddNewPageControl(AComponent: TCLComponent; xName: string): TclPageControl;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined page control should be written.
TclPageControl is a set of pages used to create a multi-page dialog box. It allows users to switch between multiple pages.
For example, it is used to create a multi-page dialog box or a tabbed notebook. TclPageControl displays multiple overlapping pages. The user selects a page by clicking on the page tab that appears at the top of the control.
Notice:
To add a new page to a TclPageControl object at design time, pages are created with TClPageControlContainer.
When the TCLPageControl object is created, it automatically assigns a default page. It adds as many pages as are created with the TClPageControlContainer object.
In the example below, we created 3 pages, but since there is a default page, it will appear as 4 pages.
| Feature | Use of | Definition |
|---|---|---|
| TclPageControl | PageControl1:TCLPageControl; | A variable belonging to the TclPageControl class is created. |
| AddNewPageControl | PageControl1= MyForm.AddNewPageControl(MyForm,'PageControl1'); | A new TclPageControl component is added to the form. |
| TClPageControlContainer | PageControlContainer1 : TClPageControlContainer; | To create a new page, an object must be defined. |
| AddContainer | PageControlContainer1 = PageControl1.AddContainer; | A new page is created through the defined object belonging to the TClPageControlContainer class. |
| ActivePage | PageControl1.ActivePage.Text = 'ACTİVE PAGE'; | TCLPageControl object represents the page that comes active when created. It is used by accessing different properties such as the text property as shown in the example. |
| Pages | PageControl1.Pages[1].Text = 'Registration page'; | The TclPageControl object represents a collection containing all the pages created on it. This property is used to access a specific page or perform a certain operation on a page. In the example, the text of the second page is being changed. |
| Mode | PageControl1.Tabsize.Mode = tsmAutoTabSize;//tsmAutoSize - tsmFixedSize - tsmFixedSizeAutoShrink - tsmAutoTabSize (default) | The property controls how the size of the tabs will be determined. Here are the possible values and their descriptions:
|
| Height | PageControl1.Tabsize.Height = 200; | Sets the height of the component's tabs. |
| Width | PageControl1.Tabsize.Width = 200; | Sets the width of the component's tabs. |
| spacing | PageControl1.Tabsize.spacing = 2; | Sets the spacing between the tabs of the component. |
| Position | PageControl1.Layout.Position = 3; //0:Left,1:Top,2:bottom,3:Right | Displays the tabs at the left, top, right or bottom position. In the example, the tabs are set to appear on the right. |
| Multiline | PageControl1.Layout.Multiline = 2;//0:None,1:Unabled,2:UnabledActiveTab | Displays the tabs on multiple lines instead of a single scrollable line. |
Example 1
var
Form1:TCLForm;
clPageControl:TCLPageControl;
clPageControlContainer:TClPageControlContainer;
{
Form1 = TCLForm.Create(Self);
clPageControl = Form1.AddNewPageControl(Form1,'clPageControl');
clPageControl.Align = alClient;
clPageControlContainer = clPageControl.AddContainer; // Creates a new page using clPageControl.
clPageControlContainer = clPageControl.AddContainer;
clPageControlContainer = clPageControl.AddContainer;
Form1.Run;
}
Example 2
var
MyForm:TCLForm;
clPageControl:TCLPageControl;
clPageControlContainer:TClPageControlContainer;
lblPage1,lblPage2,lblPage3,lblPage4 : TClProLabel;
{
MyForm = TCLForm.Create(Self);
clPageControl = MyForm.AddNewPageControl(MyForm,'clPageControl');
clPageControl.Align = alClient;
clPageControl.Layout.Position = 1;
clPageControlContainer = clPageControl.AddContainer;
clPageControlContainer = clPageControl.AddContainer;
clPageControlContainer = clPageControl.AddContainer;
clPageControl.TabSize.Margins.Top = 2;
clPageControl.ActivePage.Text = 'ACTİVE PAGE';
clPageControl.Pages[1].Text = 'Login Page';
clPageControl.Pages[2].Text = 'Profile page';
clPageControl.Pages[3].Text = 'Settings page';
clPageControl.Tabsize.Mode = tsmAutoTabSize;
clPageControl.Tabsize.spacing = 2;
lblPage1 = MyForm.AddNewProLabel(clPageControl.PageContainers[0],'lblPage1','ACTİVE PAGE');
lblPage1.Align = alCenter;
lblPage1.Height = 100;
lblPage1.Width = 150;
lblPage2 = MyForm.AddNewProLabel(clPageControl.PageContainers[1],'lblPage2','Login Page');
lblPage2.Align = alCenter;
lblPage2.Height = 100;
lblPage2.Width = 150;
lblPage3 = MyForm.AddNewProLabel(clPageControl.PageContainers[2],'lblPage3','Profile page');
lblPage3.Align = alCenter;
lblPage3.Height = 100;
lblPage3.Width = 150;
lblPage4 = MyForm.AddNewProLabel(clPageControl.PageContainers[3],'lblPage4','Settings page');
lblPage4.Align = alCenter;
lblPage4.Height = 100;
lblPage4.Width = 150;
MyForm.Run;
}
