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...")
 
No edit summary
Line 20: Line 20:
|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).
|}
|}
'''Example:'''<br>
:'''Base Syntax'''
  var
    Switch1 : TclSwitch;
    Form1:TclForm;
 
  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.Run;
 
  end;
:'''TRObject Syntax'''
  var
    Switch1 : TclSwitch;
    Form1:TclForm;
 
  {
    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.Run;
 
  }

Revision as of 07:44, 15 April 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.

SwitchView.png

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:

Base Syntax
 var
   Switch1 : TclSwitch;
   Form1:TclForm;
 
 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.Run;
 
 end;
TRObject Syntax
 var
   Switch1 : TclSwitch;
   Form1:TclForm;
 
 {
   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.Run;
 
 }