From Clomosy Docs
function AddNewPanel(AComponent: TCLComponent; xName: string): TclPanel;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined panel should be written.
Used to group and manage other components within a specific area on the form, TclPanel allows developers to allocate a distinct section in the user interface where other components (such as buttons, text boxes, labels, etc.) can be placed. This makes it easier to control the layout and appearance of components on the form.
The borders of the created panel object are only visible on Windows. On other platforms (Android, iOS), the borders are not visible.
The features and usage are provided in the table below.
| Feature | Use of | Definition |
|---|---|---|
| TclPanel | Panel1 : TclPanel; | A variable belonging to the TclPanel class is created. |
| AddNewPanel | Panel1 = Form1.AddNewPanel(Form1,'Panel1'); | A new TclPanel is added to the form. |
| Width | Panel1.Width = 150; | Allows adjusting the width of the panel. |
| Height | Panel1.Height = 50; | Allows adjusting the height of the panel. |
| Align | Panel1.Align = alTop; | With the Align parameter, you can specify where you want our component to be aligned in the form. This parameter has multiple positioning properties. See the page to learn about these features. |
| Margins | Panel1.Margins.Left = 50; // Right, Top, Bottom | With the Margins parameter, you can give margins at any scale from the right, left, bottom, top. |
| StyleLookup | Panel1.StyleLookup = 'pushpanel'; | It disables the borders of the panel. |
Example
Let's do a simple example. Let's put a layout on the panel and put a label and button inside it.
Var
MyForm:TclForm;
testPanelRow : TclPanel;
testLabel : TclLabel;
testButton : TclButton;
testLayout : TclLayout;
{
MyForm = TclForm.Create(self);
testPanelRow = MyForm.AddNewPanel(MyForm,'testPanelRow');
testPanelRow.Align = ALCenter;
testPanelRow.Height = 100;
testLayout = MyForm.AddNewLayout(testPanelRow,'testLayout');
testLayout.Align = ALCenter;
testLayout.Height = 50;
testLabel = MyForm.AddNewLabel(testLayout,'testLabel','Test');
With testLabel do
{
Align = AlLeft;
Width = 60;
Height = 20;
}
testButton = MyForm.AddNewButton(testLayout,'testButton','Send');
With testButton do
{
Align = AlNone;
Width = 50;
Height = 20;
}
MyForm.Run;
}