From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 23: | Line 23: | ||
'''Example:'''<br> | '''Example:'''<br> | ||
:'''TRObject Syntax''' | :'''TRObject Syntax''' | ||
| Line 69: | Line 47: | ||
} | } | ||
:'''Base Syntax''' | |||
var | |||
Switch1 : TclSwitch; | |||
Form1:TclForm; | |||
procedure switchState; | |||
begin | |||
ShowMessage(Switch1.IsChecked); | |||
end; | |||
begin | |||
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; | |||
end; | |||
Revision as of 12:05, 22 August 2024
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);
TComponent : The parent object of the defined component must be specified.
xName : The name of the defined TclSwitch object must be written.
| 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:
- TRObject Syntax
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;
}
- Base Syntax
var Switch1 : TclSwitch; Form1:TclForm; procedure switchState; begin ShowMessage(Switch1.IsChecked); end; begin 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; end;