From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
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> | 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 | AddNewButton(xOwner:TComponent; xName,xCaption:String): 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">''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. | ||
| Line 9: | Line 9: | ||
<span style="color:blue">''xCaption''</span> : You can add a title. | <span style="color:blue">''xCaption''</span> : You can add a title. | ||
{| 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 = MyForm.AddNewButton(MyForm,'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]. | |||
|} | |||
'''Example:'''<br> | |||
:'''TRObject Syntax''' | |||
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(<nowiki>''</nowiki>Hello<nowiki>''</nowiki>);'); | |||
MyForm.Run; | |||
} | |||
:'''Base Syntax''' | :'''Base Syntax''' | ||
var | var | ||
| Line 98: | Line 70: | ||
end; | end; | ||
'''Output:'''<br> | '''Output:'''<br> | ||
[[File:Button.png|frameless|450px]] | [[File:Button.png|frameless|450px]] | ||
Revision as of 14:03, 22 August 2024
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.
AddNewButton(xOwner:TComponent; xName,xCaption:String): TClButton
TComponent : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in.
xName : The name of the defined button should be written.
xCaption : You can add a title.
| Feature | Use of | Definition |
|---|---|---|
| TClButton | Button1 : TclButton; | A variable belonging to the TclButton class is created. |
| AddNewButton | Button1 = MyForm.AddNewButton(MyForm,'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:
- TRObject Syntax
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;
}
- Base Syntax
var
MyForm:TclForm;
testButton : TclButton;
begin
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;
end;
