Description
Gets the menu associated with the ribbon button according to the button handle.
Applies to
Syntax
controlname.GetMenuByButtonHandle ( Long ItemHandle, ref RibbonApplicationMenu ApplicationMenu )
controlname.GetMenuByButtonHandle ( Long ItemHandle, ref RibbonMenu Menu )
Argument |
Description |
---|---|
controlname |
The name of the RibbonBar control. |
ItemHandle |
The handle of the button whose menu you want to get. |
ApplicationMenu |
A RibbonApplicationMenu variable in which you want to store the menu. |
Menu |
A RibbonMenu variable in which you want to store the menu. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, returns null.
Example 1
This example inserts a "MyLargeButton" large button which is associated with a menu and then gets a copy of the menu according to the button handle.
Integer li_Return Long ll_Handle_Category, ll_Handle_panel, ll_Handle_Button RibbonLargeButtonItem lr_LargeButton RibbonMenu lr_Menu, lr_Menu2 ll_Handle_Category = rbb_1.InsertCategoryFirst ( "MyCategory" ) ll_Handle_Panel = rbb_1.InsertPanelFirst ( ll_Handle_Category, "MyPanel", "EmployeeSmall!" ) lr_LargeButton.Text = "MyLargeButton" lr_LargeButton.PictureName = "EmployeeBig!" lr_Menu.InsertItemFirst ("MyMenuItem", "EmployeeSmall!", "ue_MenuItemClicked") lr_LargeButton.SetMenu (lr_Menu) ll_Handle_Button = rbb_1.InsertLargeButtonFirst ( ll_Handle_Panel, lr_LargeButton ) li_Return = rbb_1.GetMenuByButtonHandle ( ll_Handle_Button, lr_Menu2 )
Example 2
This example inserts the "MyApp" application button which is associated with a menu (including an "Account" master item and a "RecentMenu1" recent item) and then gets a copy of the menu according to the button handle.
Integer li_Return RibbonApplicationButtonItem lr_AppButton,lr_AppButton2 RibbonApplicationMenu lr_AppMenu, lr_AppMenu2 li_Return = lr_AppMenu.InsertMasterItemFirst("Account","AccountBig!","Ue_MasterMenuClicked") li_Return = lr_AppMenu.InsertRecentItemFirst("RecentMenu1","Ue_RecentMenuClicked") li_Return = lr_AppButton.SetMenu(lr_AppMenu) lr_AppButton.Text = "MyApp" li_Return = rbb_1.SetApplicationButton(lr_AppButton) li_Return = rbb_1.GetApplicationButton(lr_AppButton2) li_Return = rbb_1.GetMenuByButtonHandle( lr_AppButton2.ItemHandle, lr_AppMenu2 )
See also