From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
CheckBox represents a TclCheckBox style checkbox that can be open (selected) or closed (cleared). The CheckBox component gives you a choice. Select the box to turn the option on or clear the box to turn the option off.
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function AddNewCheckBox(AComponent: TCLComponent; xName, xCaption: string): TclCheckBox;
</div>


AddNewCheckBox(TComponent, xName, xCaption): TclCheckBox
<span style="color:blue"><b>AComponent</b></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.<br>


<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"><b>xName</b></span> : The name of the defined chechbox should be written.<br>


<span style="color:blue"> xName</span> : The name of the defined chechbox should be written.
<span style="color:blue"><b>xCaption</b></span> : You can add a title.<br>


<span style="color:blue"> xCaption</span> : You can add a title.
CheckBox represents a TclCheckBox style checkbox that can be open (selected) or closed (cleared). The CheckBox component gives you a choice. Select the box to turn the option on or clear the box to turn the option off.<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  
|-
|-
|TclCheckBox || CheckBox1 : TclCheckBox; || A variable belonging to the TclCheckBox class is created.
|TclCheckBox || CheckBox1 : TclCheckBox; || A variable belonging to the TclCheckBox class is created.
|-
|-
|AddNewCheckBox || CheckBox1 = MyForm.AddNewCheckBox(MyForm,'CheckBox1','Test CheckBox Caption'); || A new TclCheckBox is added to the form.
|AddNewCheckBox || CheckBox1 = Form1.AddNewCheckBox(Form1,'CheckBox1','Test CheckBox Caption'); || A new TclCheckBox is added to the form.
|-
|-
|Width || CheckBox1.Width = 150; ||Allows adjusting the width of the checkbox.
|Width || CheckBox1.Width = 150; ||Allows adjusting the width of the checkbox.
Line 26: Line 29:
|TextSettings || CheckBox1.StyledSettings = ssFamily;<br><br>CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');<br><br>CheckBox1.TextSettings.Font.Size = 20;<br><br>CheckBox1.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].
|TextSettings || CheckBox1.StyledSettings = ssFamily;<br><br>CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');<br><br>CheckBox1.TextSettings.Font.Size = 20;<br><br>CheckBox1.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].
|-
|-
|Text ||CheckBox1.Text = 'CheckBox'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.
|Text ||CheckBox1.Text = 'CheckBox''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.
|-
|-
|isChecked ||CheckBox1.isChecked = True; || Assign the value True or False to the Checked property to change the checkBox's visual state. As soon as it is correct, it will come selected.
|isChecked ||CheckBox1.isChecked = True; || Assign the value True or False to the Checked property to change the checkBox's visual state. As soon as it is correct, it will come selected.
|}
|}
</div>


'''Example 1:'''<br>


:'''TRObject Syntax'''


  var
<h2>Example 1</h2><br>
    MyForm:TclForm;
<pre>
    testButton : TclButton;
var
    testLabel : TclLabel;
  MyForm:TclForm;
    testCheckBox,testCheckBox2 : TClCheckBox;
  testButton : TclButton;
 
  testLabel : TclLabel;
  void ButtonClicked;
  testCheckBox,testCheckBox2 : TClCheckBox;
  {
    testCheckBox.isChecked = not testCheckBox.isChecked;
void ButtonClicked;
    testCheckBox2.isChecked = not testCheckBox2.isChecked;
{
  }
  testCheckBox.isChecked = not testCheckBox.isChecked;
 
  testCheckBox2.isChecked = not testCheckBox2.isChecked;
  {
}
    MyForm = TclForm.Create(Self);
    testButton= MyForm.AddNewButton(MyForm,'testButton','Click');
{
    testButton.TextSettings.Font.Size=50;
  MyForm = TclForm.Create(Self);
    testButton.Align = alCenter;
  testButton= MyForm.AddNewButton(MyForm,'testButton','Click');
    testButton.Height = 50;
  testButton.TextSettings.Font.Size=50;
    testButton.Width = 100;
  testButton.Align = alCenter;
   
  testButton.Height = 50;
    testLabel = MyForm.AddNewLabel(MyForm,'testLabel','Your hobbies?');
  testButton.Width = 100;
    testLabel.StyledSettings = ssFamily;
 
    testLabel.TextSettings.Font.Size=25;
  testLabel = MyForm.AddNewLabel(MyForm,'testLabel','Your hobbies?');
    testLabel.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
  testLabel.StyledSettings = ssFamily;
    testLabel.Align = alMostTop;
  testLabel.TextSettings.Font.Size=25;
    testLabel.Height = 30;
  testLabel.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
   
  testLabel.Align = alMostTop;
    testCheckBox = MyForm.AddNewCheckBox(MyForm,'testCheckBox','Reading book');
  testLabel.Height = 30;
    testCheckBox.StyledSettings = ssFamily;
 
    testCheckBox.TextSettings.Font.Size=15;
  testCheckBox = MyForm.AddNewCheckBox(MyForm,'testCheckBox','Reading book');
    testCheckBox.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
  testCheckBox.StyledSettings = ssFamily;
    testCheckBox.Align = alTop;
  testCheckBox.TextSettings.Font.Size=15;
    testCheckBox.Height = 30;
  testCheckBox.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   
  testCheckBox.Align = alTop;
    testCheckBox2 = MyForm.AddNewCheckBox(MyForm,'testCheckBox2','Watching movie');
  testCheckBox.Height = 30;
    testCheckBox2.StyledSettings = ssFamily;
 
    testCheckBox2.TextSettings.Font.Size=15;
  testCheckBox2 = MyForm.AddNewCheckBox(MyForm,'testCheckBox2','Watching movie');
    testCheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
  testCheckBox2.StyledSettings = ssFamily;
    testCheckBox2.Align = alTop;
  testCheckBox2.TextSettings.Font.Size=15;
    testCheckBox2.Height = 30;
  testCheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   
  testCheckBox2.Align = alTop;
    MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
  testCheckBox2.Height = 30;
   
 
    MyForm.Run;
  MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
  }
 
  MyForm.Run;
}
</pre>


:'''Base Syntax'''
  var
    MyForm:TclForm;
    testButton : TclButton;
    testLabel : TclLabel;
    testCheckBox,testCheckBox2 : TClCheckBox;
 
  procedure ButtonClicked;
  begin
    testCheckBox.isChecked := not testCheckBox.isChecked;
    testCheckBox2.isChecked := not testCheckBox2.isChecked;
  end;
 
  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;
   
    testLabel := MyForm.AddNewLabel(MyForm,'testLabel','Your hobbies?');
    testLabel.StyledSettings := ssFamily;
    testLabel.TextSettings.Font.Size:=25;
    testLabel.TextSettings.FontColor := clAlphaColor.clHexToColor('#4a08ff');
    testLabel.Align := alMostTop;
    testLabel.Height := 30;
   
    testCheckBox := MyForm.AddNewCheckBox(MyForm,'testCheckBox','Reading book');
    testCheckBox.StyledSettings := ssFamily;
    testCheckBox.TextSettings.Font.Size:=15;
    testCheckBox.TextSettings.FontColor := clAlphaColor.clHexToColor('#272643');
    testCheckBox.Align := alTop;
    testCheckBox.Height := 30;
   
    testCheckBox2 := MyForm.AddNewCheckBox(MyForm,'testCheckBox2','Watching movie');
    testCheckBox2.StyledSettings := ssFamily;
    testCheckBox2.TextSettings.Font.Size:=15;
    testCheckBox2.TextSettings.FontColor := clAlphaColor.clHexToColor('#272643');
    testCheckBox2.Align := alTop;
    testCheckBox2.Height := 30;
   
    MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
   
    MyForm.Run;
  end;


<b>Output:</b><br>
[[File:CheckBox.png|frameless|450px]]<br>


<h2>Example 2</h2><br>
Here is an example similar to the first one. It only involves the clicking of a checkbox component.<br>


'''Output:'''<br>
<pre>
[[File:CheckBox.png|frameless|450px]]
var
  Form1:TclForm;
  Label1 : TclLabel;
  CheckBox1,CheckBox2 : TClCheckBox;
void CheckBoxClicked;
var
  senderCheckBox:TClCheckBox;
{
  senderCheckBox = TClCheckBox(Form1.Clsender);
  if senderCheckBox.clTagInt == 1 //CheckBox1 kontrol
    CheckBox2.isChecked =  senderCheckBox.isChecked
  else if senderCheckBox.clTagInt == 2 //CheckBox1 kontrol
    CheckBox1.isChecked = senderCheckBox.isChecked
}
{
  Form1 = TclForm.Create(Self);
 
  Label1 = Form1.AddNewLabel(Form1,'Label1','Your hobbies?');
  Label1.StyledSettings = ssFamily;
  Label1.TextSettings.Font.Size=25;
  Label1.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
  Label1.Align = alMostTop;
  Label1.Height = 30;
 
  CheckBox1 = Form1.AddNewCheckBox(Form1,'CheckBox1','Reading book');
  CheckBox1.StyledSettings = ssFamily;
  CheckBox1.TextSettings.Font.Size=15;
  CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
  CheckBox1.Align = alTop;
  CheckBox1.Height = 30;
  CheckBox1.clTagInt = 1;
 
  CheckBox2 = Form1.AddNewCheckBox(Form1,'CheckBox2','Watching movie');
  CheckBox2.StyledSettings = ssFamily;
  CheckBox2.TextSettings.Font.Size=15;
  CheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
  CheckBox2.Align = alTop;
  CheckBox2.Height = 30;
  CheckBox2.clTagInt = 2;
  Form1.AddNewEvent(CheckBox2,tbeOnClick,'CheckBoxClicked');
  Form1.AddNewEvent(CheckBox1,tbeOnClick,'CheckBoxClicked');
 
  Form1.Run;
}
</pre>


'''Example 2:'''<br>
<h2> See Also </h2>
Here is an example similar to the first one. It only involves the clicking of a checkbox component.
* [[Components]]
:'''TRObject Syntax'''
  var
    Form1:TclForm;
    Label1 : TclLabel;
    CheckBox1,CheckBox2 : TClCheckBox;
 
  void CheckBoxClicked;
  var
    senderCheckBox:TClCheckBox;
  {
    senderCheckBox = TClCheckBox(Form1.Clsender);
    if senderCheckBox.clTagInt == 1 //CheckBox1 kontrol
      CheckBox2.isChecked =  senderCheckBox.isChecked
    else if senderCheckBox.clTagInt == 2 //CheckBox1 kontrol
      CheckBox1.isChecked = senderCheckBox.isChecked
  }
 
  {
    Form1 = TclForm.Create(Self);
   
    Label1 = Form1.AddNewLabel(Form1,'Label1','Your hobbies?');
    Label1.StyledSettings = ssFamily;
    Label1.TextSettings.Font.Size=25;
    Label1.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
    Label1.Align = alMostTop;
    Label1.Height = 30;
   
    CheckBox1 = Form1.AddNewCheckBox(Form1,'CheckBox1','Reading book');
    CheckBox1.StyledSettings = ssFamily;
    CheckBox1.TextSettings.Font.Size=15;
    CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
    CheckBox1.Align = alTop;
    CheckBox1.Height = 30;
    CheckBox1.clTagInt = 1;
   
    CheckBox2 = Form1.AddNewCheckBox(Form1,'CheckBox2','Watching movie');
    CheckBox2.StyledSettings = ssFamily;
    CheckBox2.TextSettings.Font.Size=15;
    CheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
    CheckBox2.Align = alTop;
    CheckBox2.Height = 30;
    CheckBox2.clTagInt = 2;
    Form1.AddNewEvent(CheckBox2,tbeOnClick,'CheckBoxClicked');
    Form1.AddNewEvent(CheckBox1,tbeOnClick,'CheckBoxClicked');
   
    Form1.Run;
  }
 
 
:'''Base Syntax'''
 
  var
    Form1:TclForm;
    Label1 : TclLabel;
    CheckBox1,CheckBox2 : TClCheckBox;
 
  procedure CheckBoxClicked;
  var
    senderCheckBox:TClCheckBox;
  begin
    senderCheckBox := TClCheckBox(Form1.Clsender);
    if senderCheckBox.clTagInt = 1  then//CheckBox1 kontrol
      CheckBox2.isChecked :=  senderCheckBox.isChecked
    else if senderCheckBox.clTagInt = 2 then//CheckBox1 kontrol
      CheckBox1.isChecked := senderCheckBox.isChecked
  end;
 
  begin
    Form1 := TclForm.Create(Self);
   
    Label1 := Form1.AddNewLabel(Form1,'Label1','Your hobbies?');
    Label1.StyledSettings := ssFamily;
    Label1.TextSettings.Font.Size:=25;
    Label1.TextSettings.FontColor := clAlphaColor.clHexToColor('#4a08ff');
    Label1.Align := alMostTop;
    Label1.Height := 30;
   
    CheckBox1 := Form1.AddNewCheckBox(Form1,'CheckBox1','Reading book');
    CheckBox1.StyledSettings := ssFamily;
    CheckBox1.TextSettings.Font.Size:=15;
    CheckBox1.TextSettings.FontColor := clAlphaColor.clHexToColor('#272643');
    CheckBox1.Align := alTop;
    CheckBox1.Height := 30;
    CheckBox1.clTagInt := 1;
   
    CheckBox2 := Form1.AddNewCheckBox(Form1,'CheckBox2','Watching movie');
    CheckBox2.StyledSettings := ssFamily;
    CheckBox2.TextSettings.Font.Size:=15;
    CheckBox2.TextSettings.FontColor := clAlphaColor.clHexToColor('#272643');
    CheckBox2.Align := alTop;
    CheckBox2.Height := 30;
    CheckBox2.clTagInt := 2;
    Form1.AddNewEvent(CheckBox2,tbeOnClick,'CheckBoxClicked');
    Form1.AddNewEvent(CheckBox1,tbeOnClick,'CheckBoxClicked');
   
    Form1.Run;
  end;
 
 
 
= See Also =
* [[Object Properties]]
* [[Object Properties]]
* [[AddNewEvent]]
* [[AddNewEvent]]

Revision as of 10:32, 7 November 2024

AComponent : 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 chechbox should be written.

xCaption : You can add a title.

CheckBox represents a TclCheckBox style checkbox that can be open (selected) or closed (cleared). The CheckBox component gives you a choice. Select the box to turn the option on or clear the box to turn the option off.

Feature Use of Definition
TclCheckBox CheckBox1 : TclCheckBox; A variable belonging to the TclCheckBox class is created.
AddNewCheckBox CheckBox1 = Form1.AddNewCheckBox(Form1,'CheckBox1','Test CheckBox Caption'); A new TclCheckBox is added to the form.
Width CheckBox1.Width = 150; Allows adjusting the width of the checkbox.
Height CheckBox1.Height = 50; Allows adjusting the height of the checkbox.
Align CheckBox1.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 CheckBox1.Margins.Left = 50; // Right, Top, Bottom With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.
TclCheckBoxMargins.png

TextSettings CheckBox1.StyledSettings = ssFamily;

CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');

CheckBox1.TextSettings.Font.Size = 20;

CheckBox1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline]
Text formatting is performed in the component. To see the usage, see page.
Text CheckBox1.Text = 'CheckBoxs Text'; It represents the text within the component. The text entered by the user or set by the program is managed through this property.
isChecked CheckBox1.isChecked = True; Assign the value True or False to the Checked property to change the checkBox's visual state. As soon as it is correct, it will come selected.


Example 1


 var
   MyForm:TclForm;
   testButton : TclButton;
   testLabel : TclLabel;
   testCheckBox,testCheckBox2 : TClCheckBox;
 
 void ButtonClicked;
 {
   testCheckBox.isChecked = not testCheckBox.isChecked;
   testCheckBox2.isChecked = not testCheckBox2.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;
   
   testLabel = MyForm.AddNewLabel(MyForm,'testLabel','Your hobbies?');
   testLabel.StyledSettings = ssFamily;
   testLabel.TextSettings.Font.Size=25;
   testLabel.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
   testLabel.Align = alMostTop;
   testLabel.Height = 30;
   
   testCheckBox = MyForm.AddNewCheckBox(MyForm,'testCheckBox','Reading book');
   testCheckBox.StyledSettings = ssFamily;
   testCheckBox.TextSettings.Font.Size=15;
   testCheckBox.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   testCheckBox.Align = alTop;
   testCheckBox.Height = 30;
   
   testCheckBox2 = MyForm.AddNewCheckBox(MyForm,'testCheckBox2','Watching movie');
   testCheckBox2.StyledSettings = ssFamily;
   testCheckBox2.TextSettings.Font.Size=15;
   testCheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   testCheckBox2.Align = alTop;
   testCheckBox2.Height = 30;
   
   MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
   
   MyForm.Run;
 }


Output:
CheckBox.png

Example 2


Here is an example similar to the first one. It only involves the clicking of a checkbox component.

 var
   Form1:TclForm;
   Label1 : TclLabel;
   CheckBox1,CheckBox2 : TClCheckBox;
 
 void CheckBoxClicked;
 var
   senderCheckBox:TClCheckBox;
 {
   senderCheckBox = TClCheckBox(Form1.Clsender);
   if senderCheckBox.clTagInt == 1 //CheckBox1 kontrol
     CheckBox2.isChecked =  senderCheckBox.isChecked 
   else if senderCheckBox.clTagInt == 2 //CheckBox1 kontrol
     CheckBox1.isChecked = senderCheckBox.isChecked
 }
 
 {
   Form1 = TclForm.Create(Self);
   
   Label1 = Form1.AddNewLabel(Form1,'Label1','Your hobbies?');
   Label1.StyledSettings = ssFamily;
   Label1.TextSettings.Font.Size=25;
   Label1.TextSettings.FontColor = clAlphaColor.clHexToColor('#4a08ff');
   Label1.Align = alMostTop;
   Label1.Height = 30;
   
   CheckBox1 = Form1.AddNewCheckBox(Form1,'CheckBox1','Reading book');
   CheckBox1.StyledSettings = ssFamily;
   CheckBox1.TextSettings.Font.Size=15;
   CheckBox1.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   CheckBox1.Align = alTop;
   CheckBox1.Height = 30;
   CheckBox1.clTagInt = 1;
   
   CheckBox2 = Form1.AddNewCheckBox(Form1,'CheckBox2','Watching movie');
   CheckBox2.StyledSettings = ssFamily;
   CheckBox2.TextSettings.Font.Size=15;
   CheckBox2.TextSettings.FontColor = clAlphaColor.clHexToColor('#272643');
   CheckBox2.Align = alTop;
   CheckBox2.Height = 30;
   CheckBox2.clTagInt = 2;
   Form1.AddNewEvent(CheckBox2,tbeOnClick,'CheckBoxClicked');
   Form1.AddNewEvent(CheckBox1,tbeOnClick,'CheckBoxClicked');
   
   Form1.Run;
 }

See Also