From Clomosy Docs
(Created page with "Represents a two-way on-off switch for use in applications. Use a TclSwitch whenever you need to provide the user with a two-way on-off switch. AddNewSwitch(TComponent, xName); <span style="color:blue">''TComponent''</span> : The parent object of the defined component must be specified. <span style="color:blue">''xName''</span> : The name of the defined TclSwitch object must be written. frameless|100px {| class="wikitable" style="border: 2p...") |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (6 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 AddNewSwitch(AComponent: TCLComponent; xName: string): TclSwitch; | |||
</div> | |||
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br> | |||
<span style="color:blue"><b>xName</b></span> : The name of the defined TclSwitch object must be written.<br><br> | |||
< | Represents a two-way on-off switch for use in applications.<br> | ||
< | Use a TclSwitch whenever you need to provide the user with a two-way on-off switch.<br> | ||
[[File:SwitchView.png|frameless|100px]] | [[File:SwitchView.png|frameless|100px]]<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 | ||
|- | |- | ||
|TclSwitch || Switch1 : TclSwitch; || A variable belonging to the TclSwitch class is created. | |TclSwitch || Switch1 : TclSwitch; || A variable belonging to the TclSwitch class is created. | ||
| Line 20: | Line 23: | ||
|IsChecked || Switch1.IsChecked = True; || Sets the control state (checked state) of the component. The IsChecked property of the TclSwitch component indicates whether the component is checked (on) or unchecked (off). | |IsChecked || Switch1.IsChecked = True; || Sets the control state (checked state) of the component. The IsChecked property of the TclSwitch component indicates whether the component is checked (on) or unchecked (off). | ||
|} | |} | ||
</div> | |||
<br> | |||
<b>Example</b><br> | |||
<pre> | |||
var | |||
Switch1 : TclSwitch; | |||
Form1:TclForm; | |||
void switchState; | |||
{ | |||
ShowMessage(Switch1.IsChecked); | |||
} | |||
{ | |||
Form1 = TclForm.Create(Self); | |||
Switch1 = Form1.AddNewSwitch(Form1,'Switch1'); | |||
Switch1.Align = alCenter; | |||
Switch1.Height = 50; | |||
Switch1.Width = 150; | |||
//Switch1.IsChecked = True; | |||
//Switch1.Enabled = False; | |||
Form1.AddNewEvent(Switch1,tbeOnClick,'switchState'); | |||
Form1.Run; | |||
} | |||
</pre> | |||
<h2> See Also </h2> | |||
* [[Components]] | |||
* [[Object Properties]] | |||
* [[AddNewEvent]] | |||
{{#seo:|title=TclSwitch Using in Clomosy - Clomosy Docs}} | |||
{{#seo:|description=clSwitch adds a two-way on-off switch to your form, allowing users to toggle states. | |||
}} | |||
Latest revision as of 13:56, 24 December 2024
function AddNewSwitch(AComponent: TCLComponent; xName: string): TclSwitch;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined TclSwitch object must be written.
Represents a two-way on-off switch for use in applications.
Use a TclSwitch whenever you need to provide the user with a two-way on-off switch.
| Feature | Use of | Definition |
|---|---|---|
| TclSwitch | Switch1 : TclSwitch; | A variable belonging to the TclSwitch class is created. |
| AddNewSwitch | Switch1 = Form1.AddNewSwitch(Form1,'Switch1'); | A new TclSwitch component is added to the form. |
| IsChecked | Switch1.IsChecked = True; | Sets the control state (checked state) of the component. The IsChecked property of the TclSwitch component indicates whether the component is checked (on) or unchecked (off). |
Example
var
Switch1 : TclSwitch;
Form1:TclForm;
void switchState;
{
ShowMessage(Switch1.IsChecked);
}
{
Form1 = TclForm.Create(Self);
Switch1 = Form1.AddNewSwitch(Form1,'Switch1');
Switch1.Align = alCenter;
Switch1.Height = 50;
Switch1.Width = 150;
//Switch1.IsChecked = True;
//Switch1.Enabled = False;
Form1.AddNewEvent(Switch1,tbeOnClick,'switchState');
Form1.Run;
}