From Clomosy Docs
(Created page with "A ''TclButton'' is a general-purpose push button for use in applications. When the button is clicked, we can navigate to a function, procedure or activate other actions.<br> AddNewButton (TComponent, xName, xCaption): TClButton <span style="color:blue">''TComponent''</span> : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in. <span style="color:blue">''xName''</span> : The na...") |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert"> | |||
function AddNewButton(AComponent: TCLComponent; xName, xCaption: string): TclButton; | |||
</div> | |||
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br> | |||
<span style="color:blue"> | <span style="color:blue"><b>xName</b></span> : The name of the defined button should be written.<br> | ||
<span style="color:blue"> | <span style="color:blue"><b>xCaption</b></span> : You can add a title.<br> | ||
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.<br> | |||
<div class="table-responsive"> | |||
{| class="wikitable" style="border: 2px solid #c3d7e0" | |||
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| 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 [[Object_Properties#Align | 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.<br>[[File:TclButtonMargins.png|frameless|200px]]<br><br> | |||
|- | |||
|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;<br><br>Button1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');<br><br>Button1.TextSettings.Font.Size = 20;<br><br>Button1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline] || Text formatting is performed in the component. To see the usage, see [https://www.docs.clomosy.com/index.php/Object_Properties#Text_Settings page]. | |||
|} | |||
</div> | |||
<b>Example</b><br> | |||
<pre> | |||
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; | |||
} | |||
</pre> | |||
<b>Output:</b><br> | |||
[[File:Button.png|frameless|450px]]<br> | |||
<h2> See Also </h2> | |||
* [[Components]] | |||
* [[Object Properties]] | |||
* [[AddNewEvent]] | |||
{{#seo:|title=TclButton Using in Clomosy - Clomosy Docs}} | |||
{{#seo:|description=Discover TclButton in Clomosy, a versatile component for triggering actions in the UI, with customizable size, alignment, margins, and text formatting.}} | |||
Latest revision as of 14:32, 24 December 2024
function AddNewButton(AComponent: TCLComponent; xName, xCaption: string): TclButton;
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. |
| 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;
}
