From Clomosy Docs

No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Included in Clomosy's library, TclExpander is an extensible panel component. TclExpander offers a panel that can hide or open its contents with the click of a title bar by the user. It is also referred to as the accordion content structure.<br>
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
It is defined as variable follows.
function AddNewExpander(AComponent: TCLComponent; xName, xCaption: string): TclExpander;
</div>
MyExpander :TclExpander;


It is created with the "AddNewExpander" property inside the form. It gives different features to this variable with standard features.
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br>


MyExpander:= MyForm.AddNewExpander(MyForm,'MyExpander1',<nowiki>''</nowiki>);
<span style="color:blue"><b>xName</b></span> : The name of the defined component should be written.<br>
MyExpander.Align := alTop;
MyExpander.Height := 100;
MyExpander.Width := 100;


If the application is to be displayed as a drop-down menu when it is run, the IsExpanded property is set to true as follows.
<span style="color:blue"><b>xCaption</b></span> : You can add a title.<br>


MyExpander.IsExpanded := True;
Included in Clomosy's library, TclExpander is an extensible panel component. TclExpander offers a panel that can hide or open its contents with the click of a title bar by the user. It is also referred to as the accordion content structure.<br>


The header part of the TclExpanded object can be accessed with the following line of code. Here, whichever field on the form is clicked on, the information of that object is taken.
<div class="table-responsive">
{| class="wikitable" style="border: 2px solid #c3d7e0"
! style="background-color: #c3d7e0"| Feature  !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition
|-
|TclExpander || Expander1 :TclExpander; || A variable belonging to the TclExpander class is created.
|-
|AddNewExpander || Expander1 = Form1.AddNewExpander(Form1,'Expander1','Test');  || A new TclExpander is added to the form.
|-
|Width || Expander1.Width = 150; ||Allows adjusting the width of the expander.
|-
|Height || Expander1.Height = 50; ||Allows adjusting the height of the expander.
|-
|Align  || Expander1.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 [[Object_Properties#Align | page]] to learn about these features.
|-
|IsExpanded ||Expander1.IsExpanded = True; || If the application is to be displayed as a drop-down menu when it is run, the IsExpanded property is set to true as follows.
|}
</div>


TclExpander(MyForm.clSender).Text


Likewise, the following code can be used to change the visibility of which TclExpanded object is clicked.
<b>Example</b><br>
 
<pre>
TclExpander(MyForm.clSender).IsExpanded := Not TclExpander(MyForm.clSender).IsExpanded;
  var
 
'''Example:'''<br>
 
  '''var'''
   MyForm:TclStyleForm;
   MyForm:TclStyleForm;
   BtnSample:TclButton;
   BtnSample:TclButton;
Line 33: Line 40:
   MyLabel1, MyLabel2:TclLabel;
   MyLabel1, MyLabel2:TclLabel;
   
   
   '''Procedure BtnSampleClick;'''
   void BtnSampleClick;
   '''Begin'''
   {
     MyExpander1.IsExpanded := Not MyExpander1.IsExpanded;
     MyExpander1.IsExpanded = Not MyExpander1.IsExpanded;
     MyExpander2.IsExpanded := Not MyExpander2.IsExpanded;
     MyExpander2.IsExpanded = Not MyExpander2.IsExpanded;
   '''End;'''
   }
    
    
   '''Procedure MyExpanderClick;'''
   void MyExpanderClick;
   '''begin'''
   var
     ShowMessage(TclExpander(MyForm.clSender).Text);
     senderExpander:TclExpander;
     TclExpander(MyForm.clSender).IsExpanded := Not TclExpander(MyForm.clSender).IsExpanded;
  {
   '''End;'''
    senderExpander = TclExpander(MyForm.clSender);
    ShowMessage(senderExpander.Text);
     senderExpander.IsExpanded = Not senderExpander.IsExpanded;
   }
    
    
  '''begin'''
  {
   MyForm := TclStyleForm.Create(Self);
   MyForm = TclStyleForm.Create(Self);
   MyForm.clSetStyle(MyForm.LightSB);
   MyForm.clSetStyle(MyForm.LightSB);
   BtnSample:= MyForm.AddNewButton(MyForm,'BtnSample','Add');
   BtnSample= MyForm.AddNewButton(MyForm,'BtnSample','Add');
   BtnSample.Align := alTop;
   BtnSample.Align = alTop;
   MyForm.AddNewEvent(BtnSample,tbeOnClick,'BtnSampleClick');
   MyForm.AddNewEvent(BtnSample,tbeOnClick,'BtnSampleClick');
    
    
   MyVertBox:= MyForm.AddNewVertScrollBox(MyForm,'MyVertBox');
   MyVertBox= MyForm.AddNewVertScrollBox(MyForm,'MyVertBox');
   MyVertBox.Align := alClient;
   MyVertBox.Align = alClient;
   
   
   MyExpander1:= MyForm.AddNewExpander(MyVertBox,'MyExpander1',<nowiki>''</nowiki>);
   MyExpander1= MyForm.AddNewExpander(MyVertBox,'MyExpander1','');
   MyExpander1.Align := alTop;
   MyExpander1.Align = alTop;
   MyExpander1.Height := 100;
   MyExpander1.Height = 100;
   MyForm.AddNewEvent(MyExpander1,tbeOnClick,'MyExpanderClick');  
   MyForm.AddNewEvent(MyExpander1,tbeOnClick,'MyExpanderClick');  
    
    
   MyLayout1:= MyForm.AddNewLayout(MyExpander1,'MyLayout1');
   MyLayout1= MyForm.AddNewLayout(MyExpander1,'MyLayout1');
   MyLayout1.Align := alClient;
   MyLayout1.Align = alClient;
    
    
   MyLabel1:= MyForm.AddNewLabel(MyLayout1,'MyLabel1','My Expander Label Caption');
   MyLabel1= MyForm.AddNewLabel(MyLayout1,'MyLabel1','My Expander Label Caption');
   MyLabel1.Align := alTop;
   MyLabel1.Align = alTop;
   
   
   MyExpander2:= MyForm.AddNewExpander(MyVertBox,'MyExpander2',<nowiki>''</nowiki>);
   MyExpander2= MyForm.AddNewExpander(MyVertBox,'MyExpander2','');
   MyExpander2.Align := alTop;
   MyExpander2.Align = alTop;
   MyExpander2.Height := 100;
   MyExpander2.Height = 100;
   MyForm.AddNewEvent(MyExpander2,tbeOnClick,'MyExpanderClick');
   MyForm.AddNewEvent(MyExpander2,tbeOnClick,'MyExpanderClick');
    
    
   MyLayout2:= MyForm.AddNewLayout(MyExpander2,'MyLayout2');
   MyLayout2= MyForm.AddNewLayout(MyExpander2,'MyLayout2');
   MyLayout2.Align := alClient;
   MyLayout2.Align = alClient;
    
    
   MyLabel2:= MyForm.AddNewLabel(MyLayout2,'MyLabel2','My Expander Label Caption 2');
   MyLabel2= MyForm.AddNewLabel(MyLayout2,'MyLabel2','My Expander Label Caption 2');
   MyLabel2.Align := alTop;
   MyLabel2.Align = alTop;
   
   
   MyForm.Run;
   MyForm.Run;
   
   
  '''end;'''
  }
</pre>
 
<b>Output:</b><br>
[[File:TclExpanderScreen.png|frameless|350px]]<br>


'''Output:'''<br>
<h2> See Also </h2>
[[File:TclExpanderScreen.png|frameless|350px]]
* [[Components]]
* [[Object Properties]]
* [[AddNewEvent]]
{{#seo:|title=TclExpander Using in Clomosy - Clomosy Docs}}
{{#seo:|description=Discover TclExpander in Clomosy, a collapsible panel component for creating toggleable content, perfect for accordion-style interfaces.}}

Latest revision as of 14:57, 24 December 2024

AComponent : Specifies the parent of the object to be defined.

xName : The name of the defined component should be written.

xCaption : You can add a title.

Included in Clomosy's library, TclExpander is an extensible panel component. TclExpander offers a panel that can hide or open its contents with the click of a title bar by the user. It is also referred to as the accordion content structure.

Feature Use of Definition
TclExpander Expander1 :TclExpander; A variable belonging to the TclExpander class is created.
AddNewExpander Expander1 = Form1.AddNewExpander(Form1,'Expander1','Test'); A new TclExpander is added to the form.
Width Expander1.Width = 150; Allows adjusting the width of the expander.
Height Expander1.Height = 50; Allows adjusting the height of the expander.
Align Expander1.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.
IsExpanded Expander1.IsExpanded = True; If the application is to be displayed as a drop-down menu when it is run, the IsExpanded property is set to true as follows.


Example

 var
   MyForm:TclStyleForm;
   BtnSample:TclButton;
   MyVertBox:TClVertScrollBox;
   MyExpander1,MyExpander2:TclExpander;
   MyLayout1, MyLayout2:TclLayout;
   MyLabel1, MyLabel2:TclLabel;
 
   void BtnSampleClick;
   {
     MyExpander1.IsExpanded = Not MyExpander1.IsExpanded;
     MyExpander2.IsExpanded = Not MyExpander2.IsExpanded;
   }
  
   void MyExpanderClick;
   var
     senderExpander:TclExpander;
   {
     senderExpander = TclExpander(MyForm.clSender);
     ShowMessage(senderExpander.Text);
     senderExpander.IsExpanded = Not senderExpander.IsExpanded;
   }
   
 { 
   MyForm = TclStyleForm.Create(Self);
   MyForm.clSetStyle(MyForm.LightSB);
   BtnSample= MyForm.AddNewButton(MyForm,'BtnSample','Add');
   BtnSample.Align = alTop;
   MyForm.AddNewEvent(BtnSample,tbeOnClick,'BtnSampleClick');
   
   MyVertBox= MyForm.AddNewVertScrollBox(MyForm,'MyVertBox');
   MyVertBox.Align = alClient;
 
   MyExpander1= MyForm.AddNewExpander(MyVertBox,'MyExpander1','');
   MyExpander1.Align = alTop;
   MyExpander1.Height = 100;
   MyForm.AddNewEvent(MyExpander1,tbeOnClick,'MyExpanderClick'); 
  
   MyLayout1= MyForm.AddNewLayout(MyExpander1,'MyLayout1');
   MyLayout1.Align = alClient;
  
   MyLabel1= MyForm.AddNewLabel(MyLayout1,'MyLabel1','My Expander Label Caption');
   MyLabel1.Align = alTop;
 
   MyExpander2= MyForm.AddNewExpander(MyVertBox,'MyExpander2','');
   MyExpander2.Align = alTop;
   MyExpander2.Height = 100;
   MyForm.AddNewEvent(MyExpander2,tbeOnClick,'MyExpanderClick');
   
   MyLayout2= MyForm.AddNewLayout(MyExpander2,'MyLayout2');
   MyLayout2.Align = alClient;
   
   MyLabel2= MyForm.AddNewLabel(MyLayout2,'MyLabel2','My Expander Label Caption 2');
   MyLabel2.Align = alTop;
 
   MyForm.Run;
 
 }

Output:
TclExpanderScreen.png

See Also