From Clomosy Docs
No edit summary |
No edit summary |
||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
"TclMenuFrame | <div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert"> | ||
function AddNewMenuFrame(AComponent: TCLComponent; xName: string): TclMenuFrame; | |||
</div> | |||
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br> | |||
<span style="color:blue"><b>xName</b></span> : The name of the defined component should be written.<br> | |||
"TclMenuFrame" is a component frame type in Clomosy. This frame can be used as a menu component and helps create menu options in the application.<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 | ||
|- | |||
|TClMenuFrame || MenuFrame1 : TClMenuFrame; || A variable belonging to the TclMenuFrame class is created. | |||
|- | |- | ||
| | |AddNewMenuFrame ||MenuFrame1 = Form1.AddNewMenuFrame(Form1,'MenuFrame1'); ||A new Menu Frame is added to the form. | ||
|- | |- | ||
| | |Align ||MenuFrame1.Align = alContents; ||Alignment adjustment is made. | ||
|- | |- | ||
| | |MenuBar ||MenuFrame1.MenuBar.Width = 250; MenuFrame1.MenuBar.Height = 250; || It defines the main menu of the application and provides users with access to application functions. With this, adjustments such as height and width can be made. | ||
|- | |- | ||
| | |Visible ||MenuFrame1.Visible = False; ||Visibility settings can be adjusted. If it is true it is visible, if it is false it is not visible. | ||
|- | |- | ||
| | |ClMenuPosition ||MenuFrame1.ClMenuPosition = clLeft;||Menu Frame position is set.(Default => clRight) | ||
|- | |- | ||
| | |VertScrollBox ||MenuFrame1.VertScrollBox || The MenuFrame provides an area with a vertical scrollbar within. This allows objects placed inside it to be created and displayed vertically one below the other. | ||
|} | |} | ||
</div> | |||
<b>Example</b><br> | |||
<pre> | |||
Var | |||
MyForm : TclForm; | MyForm : TclForm; | ||
TstSideMenu : TClMenuFrame; | TstSideMenu : TClMenuFrame; | ||
ShowBtn,menuBtn: TClProButton; | ShowBtn,menuBtn: TClProButton; | ||
MenuItem1, MenuItem2: TClProButton; | |||
void showMenuFrame; | |||
TstSideMenu.Visible | { | ||
TstSideMenu.Visible = True; | |||
clRTMethod(TstSideMenu, 'BringTofront'); | clRTMethod(TstSideMenu, 'BringTofront'); | ||
} | |||
void showShowBtn; | |||
{ | |||
TstSideMenu.Visible | TstSideMenu.Visible = False; | ||
clRTMethod(menuBtn, 'BringTofront'); | clRTMethod(menuBtn, 'BringTofront'); | ||
} | |||
{ | |||
MyForm | MyForm = TclForm.Create(Self); | ||
TstSideMenu | TstSideMenu = MyForm.AddNewMenuFrame(MyForm,'TstSideMenu'); | ||
TstSideMenu.Align | TstSideMenu.Align = alContents; | ||
TstSideMenu.MenuBar.Width | TstSideMenu.MenuBar.Width = 250; | ||
TstSideMenu.Visible | TstSideMenu.Visible = False; | ||
TstSideMenu.ClMenuPosition | TstSideMenu.ClMenuPosition = clLeft; | ||
menuBtn | menuBtn= MyForm.AddNewProButton(MyForm,'menuBtn','menu'); | ||
menuBtn.Align = AlLeft; | |||
menuBtn.Width = 60; | |||
menuBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#A5C9CA'); | |||
menuBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F'); | |||
menuBtn.clProSettings.TextSettings.Font.Style = [fsBold]; | |||
menuBtn.clProSettings.IsRound = True; | |||
menuBtn.clProSettings.RoundHeight = 10; | |||
menuBtn.clProSettings.RoundWidth = 10; | |||
menuBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#C7D8D8'); | |||
menuBtn.clProSettings.BorderWidth = 2; | |||
menuBtn.SetclProSettings(menuBtn.clProSettings); | |||
MyForm.AddNewEvent(menuBtn,tbeOnClick,'showMenuFrame'); | MyForm.AddNewEvent(menuBtn,tbeOnClick,'showMenuFrame'); | ||
ShowBtn | ShowBtn= MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'ShowBtn','Close'); | ||
ShowBtn.Align = AlTop; | |||
ShowBtn.Height = 40; | |||
ShowBtn.Margins.Top = 10; | |||
ShowBtn.clProSettings.FontHorzAlign = palCenter; | |||
ShowBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E7D4B5'); | |||
ShowBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#FFFFFF'); | |||
ShowBtn.clProSettings.TextSettings.Font.Style = [fsBold]; | |||
ShowBtn.clProSettings.IsRound = True; | |||
ShowBtn.clProSettings.RoundHeight = 10; | |||
ShowBtn.clProSettings.RoundWidth = 10; | |||
ShowBtn.clProSettings.BorderWidth = 2; | |||
ShowBtn.SetclProSettings(ShowBtn.clProSettings); | |||
MyForm.AddNewEvent(ShowBtn,tbeOnClick,'showShowBtn'); | MyForm.AddNewEvent(ShowBtn,tbeOnClick,'showShowBtn'); | ||
MenuItem1 = MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'MenuItem1','Main Page'); | |||
MenuItem1.Align = AlTop; | |||
MenuItem1.Height = 40; | |||
MenuItem1.Margins.Top = 15; | |||
MenuItem1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#D2E9E9'); | |||
MenuItem1.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F'); | |||
MenuItem1.clProSettings.IsRound = True; | |||
MenuItem1.clProSettings.RoundHeight = 8; | |||
MenuItem1.clProSettings.RoundWidth = 8; | |||
MenuItem1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#C7D8D8'); | |||
MenuItem1.SetclProSettings(MenuItem1.clProSettings); | |||
MenuItem2 = MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'MenuItem2','Settings'); | |||
MenuItem2.Align = AlTop; | |||
MenuItem2.Height = 40; | |||
MenuItem2.Margins.Top = 10; | |||
MenuItem2.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#F6EACB'); | |||
MenuItem2.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F'); | |||
MenuItem2.clProSettings.IsRound = True; | |||
MenuItem2.clProSettings.RoundHeight = 8; | |||
MenuItem2.clProSettings.RoundWidth = 8; | |||
MenuItem2.clProSettings.BorderColor = clAlphaColor.clHexToColor('#EAD7BB'); | |||
MenuItem2.SetclProSettings(MenuItem2.clProSettings); | |||
MyForm.Run; | MyForm.Run; | ||
} | |||
</pre> | |||
<b>Output</b><br> | |||
[[File:TclMenuFrame.gif|frameless|thumb|600px]] | |||
<h2> See Also </h2> | |||
* [[Components]] | |||
* [[Object Properties]] | |||
* [[AddNewEvent]] | |||
{{#seo:|title=TclMenuFrame Using - Clomosy Docs}} | |||
{{#seo:|description=Explore TclMenuFrame on Clomosy. Learn about its structure, functionality, and integration for building efficient menu-driven applications.}} | |||
Latest revision as of 15:27, 6 November 2025
function AddNewMenuFrame(AComponent: TCLComponent; xName: string): TclMenuFrame;
AComponent : Specifies the parent of the object to be defined.
xName : The name of the defined component should be written.
"TclMenuFrame" is a component frame type in Clomosy. This frame can be used as a menu component and helps create menu options in the application.
| Feature | Use of | Definition |
|---|---|---|
| TClMenuFrame | MenuFrame1 : TClMenuFrame; | A variable belonging to the TclMenuFrame class is created. |
| AddNewMenuFrame | MenuFrame1 = Form1.AddNewMenuFrame(Form1,'MenuFrame1'); | A new Menu Frame is added to the form. |
| Align | MenuFrame1.Align = alContents; | Alignment adjustment is made. |
| MenuBar | MenuFrame1.MenuBar.Width = 250; MenuFrame1.MenuBar.Height = 250; | It defines the main menu of the application and provides users with access to application functions. With this, adjustments such as height and width can be made. |
| Visible | MenuFrame1.Visible = False; | Visibility settings can be adjusted. If it is true it is visible, if it is false it is not visible. |
| ClMenuPosition | MenuFrame1.ClMenuPosition = clLeft; | Menu Frame position is set.(Default => clRight) |
| VertScrollBox | MenuFrame1.VertScrollBox | The MenuFrame provides an area with a vertical scrollbar within. This allows objects placed inside it to be created and displayed vertically one below the other. |
Example
Var
MyForm : TclForm;
TstSideMenu : TClMenuFrame;
ShowBtn,menuBtn: TClProButton;
MenuItem1, MenuItem2: TClProButton;
void showMenuFrame;
{
TstSideMenu.Visible = True;
clRTMethod(TstSideMenu, 'BringTofront');
}
void showShowBtn;
{
TstSideMenu.Visible = False;
clRTMethod(menuBtn, 'BringTofront');
}
{
MyForm = TclForm.Create(Self);
TstSideMenu = MyForm.AddNewMenuFrame(MyForm,'TstSideMenu');
TstSideMenu.Align = alContents;
TstSideMenu.MenuBar.Width = 250;
TstSideMenu.Visible = False;
TstSideMenu.ClMenuPosition = clLeft;
menuBtn= MyForm.AddNewProButton(MyForm,'menuBtn','menu');
menuBtn.Align = AlLeft;
menuBtn.Width = 60;
menuBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#A5C9CA');
menuBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F');
menuBtn.clProSettings.TextSettings.Font.Style = [fsBold];
menuBtn.clProSettings.IsRound = True;
menuBtn.clProSettings.RoundHeight = 10;
menuBtn.clProSettings.RoundWidth = 10;
menuBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#C7D8D8');
menuBtn.clProSettings.BorderWidth = 2;
menuBtn.SetclProSettings(menuBtn.clProSettings);
MyForm.AddNewEvent(menuBtn,tbeOnClick,'showMenuFrame');
ShowBtn= MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'ShowBtn','Close');
ShowBtn.Align = AlTop;
ShowBtn.Height = 40;
ShowBtn.Margins.Top = 10;
ShowBtn.clProSettings.FontHorzAlign = palCenter;
ShowBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#E7D4B5');
ShowBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#FFFFFF');
ShowBtn.clProSettings.TextSettings.Font.Style = [fsBold];
ShowBtn.clProSettings.IsRound = True;
ShowBtn.clProSettings.RoundHeight = 10;
ShowBtn.clProSettings.RoundWidth = 10;
ShowBtn.clProSettings.BorderWidth = 2;
ShowBtn.SetclProSettings(ShowBtn.clProSettings);
MyForm.AddNewEvent(ShowBtn,tbeOnClick,'showShowBtn');
MenuItem1 = MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'MenuItem1','Main Page');
MenuItem1.Align = AlTop;
MenuItem1.Height = 40;
MenuItem1.Margins.Top = 15;
MenuItem1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#D2E9E9');
MenuItem1.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F');
MenuItem1.clProSettings.IsRound = True;
MenuItem1.clProSettings.RoundHeight = 8;
MenuItem1.clProSettings.RoundWidth = 8;
MenuItem1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#C7D8D8');
MenuItem1.SetclProSettings(MenuItem1.clProSettings);
MenuItem2 = MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'MenuItem2','Settings');
MenuItem2.Align = AlTop;
MenuItem2.Height = 40;
MenuItem2.Margins.Top = 10;
MenuItem2.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#F6EACB');
MenuItem2.clProSettings.FontColor = clAlphaColor.clHexToColor('#2E4F4F');
MenuItem2.clProSettings.IsRound = True;
MenuItem2.clProSettings.RoundHeight = 8;
MenuItem2.clProSettings.RoundWidth = 8;
MenuItem2.clProSettings.BorderColor = clAlphaColor.clHexToColor('#EAD7BB');
MenuItem2.SetclProSettings(MenuItem2.clProSettings);
MyForm.Run;
}
Output
