From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (3 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 AddNewRadioButton(AComponent: TCLComponent; xName, xCaption: string): TclRadioButton; | |||
</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 radio button should be written.<br> | ||
<span style="color:blue"> | <span style="color:blue"><b>xCaption</b></span> : You can add a title.<br> | ||
Radio buttons, also called option buttons, present a set of mutually exclusive choices. You can create individual radio buttons using TClRadioButton. A selected radio button is displayed as a circle filled in the middle. When not selected, the radio button shows an empty circle.<br> | |||
<div class="table-responsive"> | |||
{| class="wikitable" style="border: 2px solid #c3d7e0" | {| class="wikitable" style="border: 2px solid #c3d7e0" | ||
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition | ! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition | ||
|- | |- | ||
|TclRadioButton || RadioButton1 : TclRadioButton; || A variable belonging to the TclRadioButton class is created. | |TclRadioButton || RadioButton1 : TclRadioButton; || A variable belonging to the TclRadioButton class is created. | ||
|- | |- | ||
|AddNewRadioButton || RadioButton1 = | |AddNewRadioButton || RadioButton1 = Form1.AddNewRadioButton(Form1,'RadioButton1','Test Radio Button Caption'); || A new TclRadioButton is added to the form. | ||
|- | |- | ||
|Width || RadioButton1.Width = 150; ||Allows adjusting the width of the radioButton. | |Width || RadioButton1.Width = 150; ||Allows adjusting the width of the radioButton. | ||
| Line 30: | Line 34: | ||
|isChecked ||RadioButton1.isChecked = True; || Assign the value True or False to the Checked property to change the radio button's visual state. As soon as it is correct, it will come selected. | |isChecked ||RadioButton1.isChecked = True; || Assign the value True or False to the Checked property to change the radio button's visual state. As soon as it is correct, it will come selected. | ||
|} | |} | ||
</div> | |||
<b>Example</b><br> | |||
Example let's put 2 radioButtons on the form. Here, when one is clicked and I click on the other, we will see that the clicked one is unticked. Now you can create a project with the options you want in the design you want with the radioButton.<br> | Example let's put 2 radioButtons on the form. Here, when one is clicked and I click on the other, we will see that the clicked one is unticked. Now you can create a project with the options you want in the design you want with the radioButton.<br> | ||
<pre> | |||
var | |||
MyForm:TclForm; | |||
testButton : TclButton; | |||
testRadio,testRadio2 : TClRadioButton; | |||
void ButtonClicked; | |||
{ | |||
testRadio.isChecked = not testRadio.isChecked; | |||
} | |||
{ | |||
MyForm = TclForm.Create(Self); | |||
testButton= MyForm.AddNewButton(MyForm,'testButton','Click'); | |||
testButton.TextSettings.Font.Size=50; | |||
testButton.Align = alCenter; | |||
testButton.Height = 50; | |||
testButton.Width = 100; | |||
testRadio = MyForm.AddNewRadioButton(MyForm,'testRadio','Female'); | |||
testRadio.StyledSettings = ssFamily; | |||
testRadio.TextSettings.Font.Size=25; | |||
testRadio.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c'); | |||
testRadio.Align = alTop; | |||
testRadio.Height = 30; | |||
testRadio2 = MyForm.AddNewRadioButton(MyForm,'testRadio2','Male'); | |||
testRadio2.StyledSettings = ssFamily; | |||
testRadio2.TextSettings.Font.Size=25; | |||
testRadio2.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c'); | |||
testRadio2.Align = alTop; | |||
testRadio2.Height = 30; | |||
MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked'); | |||
MyForm.Run; | |||
} | |||
</pre> | |||
<b>Output:</b><br> | |||
[[File:RadioButton.png|frameless|450px]] | [[File:RadioButton.png|frameless|450px]]<br> | ||
<h2> See Also </h2> | |||
* [[Components]] | |||
* [[Object Properties]] | * [[Object Properties]] | ||
* [[AddNewEvent]] | * [[AddNewEvent]] | ||
{{#seo:|title=TclRadioButton Using - Clomosy Docs}} | |||
{{#seo:|description=Learn about TclRadioButton on Clomosy! Your go-to resource for creating responsive and user-friendly radio button elements.}} | |||
Latest revision as of 13:26, 24 December 2024
function AddNewRadioButton(AComponent: TCLComponent; xName, xCaption: string): TclRadioButton;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined radio button should be written.
xCaption : You can add a title.
Radio buttons, also called option buttons, present a set of mutually exclusive choices. You can create individual radio buttons using TClRadioButton. A selected radio button is displayed as a circle filled in the middle. When not selected, the radio button shows an empty circle.
| Feature | Use of | Definition |
|---|---|---|
| TclRadioButton | RadioButton1 : TclRadioButton; | A variable belonging to the TclRadioButton class is created. |
| AddNewRadioButton | RadioButton1 = Form1.AddNewRadioButton(Form1,'RadioButton1','Test Radio Button Caption'); | A new TclRadioButton is added to the form. |
| Width | RadioButton1.Width = 150; | Allows adjusting the width of the radioButton. |
| Height | RadioButton1.Height = 50; | Allows adjusting the height of the radioButton. |
| Align | RadioButton1.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 | RadioButton1.Margins.Left = 50; // Right, Top, Bottom | With the Margins parameter, you can give margins at any scale from the right, left, bottom, top. |
| Text | RadioButton1.Text = 'RaidoButton'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 | RadioButton1.StyledSettings = ssFamily; RadioButton1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c'); RadioButton1.TextSettings.Font.Size = 20; RadioButton1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline] |
Text formatting is performed in the component. To see the usage, see page. |
| isChecked | RadioButton1.isChecked = True; | Assign the value True or False to the Checked property to change the radio button's visual state. As soon as it is correct, it will come selected. |
Example
Example let's put 2 radioButtons on the form. Here, when one is clicked and I click on the other, we will see that the clicked one is unticked. Now you can create a project with the options you want in the design you want with the radioButton.
var
MyForm:TclForm;
testButton : TclButton;
testRadio,testRadio2 : TClRadioButton;
void ButtonClicked;
{
testRadio.isChecked = not testRadio.isChecked;
}
{
MyForm = TclForm.Create(Self);
testButton= MyForm.AddNewButton(MyForm,'testButton','Click');
testButton.TextSettings.Font.Size=50;
testButton.Align = alCenter;
testButton.Height = 50;
testButton.Width = 100;
testRadio = MyForm.AddNewRadioButton(MyForm,'testRadio','Female');
testRadio.StyledSettings = ssFamily;
testRadio.TextSettings.Font.Size=25;
testRadio.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');
testRadio.Align = alTop;
testRadio.Height = 30;
testRadio2 = MyForm.AddNewRadioButton(MyForm,'testRadio2','Male');
testRadio2.StyledSettings = ssFamily;
testRadio2.TextSettings.Font.Size=25;
testRadio2.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');
testRadio2.Align = alTop;
testRadio2.Height = 30;
MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
MyForm.Run;
}
