From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert"> | |||
function AddNewExpander(AComponent: TCLComponent; xName, xCaption: string): TclExpander; | |||
</div> | |||
<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"><b>xName</b></span> : The name of the defined component should be written.<br> | |||
<span style="color:blue"><b>xCaption</b></span> : You can add a title.<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> | 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="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 | ||
|- | |- | ||
|TclExpander || Expander1 :TclExpander; || A variable belonging to the TclExpander class is created. | |TclExpander || Expander1 :TclExpander; || A variable belonging to the TclExpander class is created. | ||
|- | |- | ||
|AddNewExpander || Expander1 = | |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. | |Width || Expander1.Width = 150; ||Allows adjusting the width of the expander. | ||
| Line 17: | Line 27: | ||
|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. | |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> | |||
<b>Example</b><br> | |||
<pre> | |||
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; | |||
} | |||
</pre> | |||
<b>Output:</b><br> | |||
[[File:TclExpanderScreen.png|frameless|350px]]<br> | |||
<h2> See Also </h2> | |||
[[ | * [[Components]] | ||
* [[Object Properties]] | |||
* [[AddNewEvent]] | |||
Revision as of 10:58, 7 November 2024
function AddNewExpander(AComponent: TCLComponent; xName, xCaption: string): TclExpander;
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 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;
}