From Clomosy Docs
No edit summary |
No edit summary |
||
| 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> | 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> | ||
{| 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 = MyForm.AddNewExpander(MyForm,'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. | |||
|} | |||
'''Example:'''<br> | |||
:'''TRObject Syntax''' | |||
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',<nowiki>''</nowiki>); | |||
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',<nowiki>''</nowiki>); | |||
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; | |||
} | |||
:'''Base Syntax''' | :'''Base Syntax''' | ||
| Line 84: | Line 141: | ||
end; | end; | ||
'''Output:'''<br> | '''Output:'''<br> | ||
[[File:TclExpanderScreen.png|frameless|350px]] | [[File:TclExpanderScreen.png|frameless|350px]] | ||
Revision as of 14:44, 22 August 2024
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 = MyForm.AddNewExpander(MyForm,'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:
- TRObject Syntax
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;
}
- Base Syntax
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;
var
senderExpander:TclExpander;
begin
senderExpander := TclExpander(MyForm.clSender);
ShowMessage(senderExpander.Text);
senderExpander.IsExpanded := Not senderExpander.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;