From Clomosy Docs

No edit summary
No edit summary
Line 92: Line 92:
* [[Object Properties]]
* [[Object Properties]]
* [[AddNewEvent]]
* [[AddNewEvent]]
{{#seo:|description=Explore TclMenuFrame on Clomosy. Learn about its structure, functionality, and integration for building efficient menu-driven applications.}}

Revision as of 06:37, 24 December 2024

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;

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;   //Default clRight 
  
  menuBtn= MyForm.AddNewProButton(MyForm,'menuBtn','...');
  menuBtn.Align = AlLeft;
  menuBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#7295ed');
  menuBtn.clProSettings.FontColor = clAlphaColor.clHexToColor('#ffffff');
  menuBtn.clProSettings.TextSettings.Font.Style = [fsBold];
  menuBtn.clProSettings.IsRound = True;
  menuBtn.clProSettings.RoundHeight = 10;
  menuBtn.clProSettings.RoundWidth = 10;
  menuBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#808080');
  menuBtn.clProSettings.BorderWidth = 2;
  menuBtn.SetclProSettings(menuBtn.clProSettings);
  MyForm.AddNewEvent(menuBtn,tbeOnClick,'showMenuFrame');
  
  ShowBtn= MyForm.AddNewProButton(TstSideMenu.VertScrollBox,'ShowBtn','Show');
  ShowBtn.Align = AlTop;
  ShowBtn.Height = 40;
  ShowBtn.Margins.Top = 10;
  ShowBtn.clProSettings.FontHorzAlign = palCenter;
  ShowBtn.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#fc6713');
  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.Run;  
}

See Also