From Clomosy Docs

Revision as of 11:08, 5 June 2023 by ClomosyManager (talk | contribs) (Created page with "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> It is defined as variable follows. MyExpander :TclExpander; It is created with the "AddNewExpander" property inside the form. It gives different features to this variable with standard features. MyExpander:= MyForm.AddNewExp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.
It is defined as variable follows.

MyExpander :TclExpander;

It is created with the "AddNewExpander" property inside the form. It gives different features to this variable with standard features.

MyExpander:= MyForm.AddNewExpander(MyForm,'MyExpander1','');
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.

MyExpander.IsExpanded := True;

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.

TclExpander(MyForm.clSender).Text

Likewise, the following code can be used to change the visibility of which TclExpanded object is clicked.

TclExpander(MyForm.clSender).IsExpanded := Not TclExpander(MyForm.clSender).IsExpanded;

Example:

var
  MyForm:TclStyleForm;
  BtnSample:TclButton;
  MyVertBox:TClVertScrollBox;
  MyExpander1,MyExpander2:TclExpander;
  MyLayout1, MyLayout2:TclLayout;
  MyLabel1, MyLabel2:TclLabel;

  Procedure BtnSampleClick;
  Begin
    MyExpander1.IsExpanded := Not MyExpander1.IsExpanded;
    MyExpander2.IsExpanded := Not MyExpander2.IsExpanded;
  End;
 
  Procedure MyExpanderClick;
  begin
    ShowMessage(TclExpander(MyForm.clSender).Text);
    TclExpander(MyForm.clSender).IsExpanded := Not TclExpander(MyForm.clSender).IsExpanded;
  End;
  
begin 
  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;

end;

Output:
TclExpanderScreen.png