From Clomosy Docs

AComponent : Specifies the parent of the object to be defined.

xName : The name of the defined button should be written.

xCaption : You can add a title.

It is a component used to perform a specific action in the user interface. When a button is placed on the form, it allows the user to trigger a particular function by clicking it. For example, a "Save" button can be added to allow data to be saved.

Feature Use of Definition
TClButton Button1 : TclButton; A variable belonging to the TclButton class is created.
AddNewButton Button1 = Form1.AddNewButton(Form1,'Button1','Test Button Caption'); A new TclButton is added to the form.
Width Button1.Width = 150; Allows adjusting the width of the button.
Height Button1.Height = 50; Allows adjusting the height of the button.
Align Button1.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 Button1.Margins.Left = 50; // Right, Top, Bottom With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.
TclButtonMargins.png

Caption Button1.Caption = 'Button Caption'; It represents the text displayed on the component. The Caption specifies the textual label that the component presents to the user.
Text Button1.Text = 'Button's Text'; It represents the text within the component. The text entered by the user or set by the program is managed through this property.
TextSettings Button1.StyledSettings = ssFamily;

Button1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');

Button1.TextSettings.Font.Size = 20;

Button1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline]
Text formatting is performed in the component. To see the usage, see page.


Example

 var
   MyForm:TclForm;
   testButton : TclButton;
 
 {
   MyForm = TclForm.Create(Self);
   testButton= MyForm.AddNewButton(MyForm,'testButton','Click');
   testButton.TextSettings.Font.Size=50;
   testButton.Align = alCenter;
   testButton.Height = 50;
   testButton.Width = 100;
   
   MyForm.AddNewEvent(testButton,tbeOnClick,'ShowMessage(''Hello'');');
   
   MyForm.Run;
 
 }

Output:
Button.png

See Also