From Clomosy Docs

No edit summary
No edit summary
 
Line 99: Line 99:
* [[Object Properties]]
* [[Object Properties]]
* [[AddNewEvent]]
* [[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.}}
{{#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