GetMenu

Description

Gets the menu that is associated with the ribbon button.

Applies to

RibbonApplicationButtonItem, RibbonTabButtonItem, RibbonLargeButtonItem, RibbonSmallButtonItem controls

Syntax

For RibbonApplicationButtonItem:

controlname.GetMenu ( ref RibbonApplicationMenu ApplicationMenu )

For RibbonTabButtonItem, RibbonLargeButtonItem, and RibbonSmallButtonItem:

controlname.GetMenu ( ref RibbonMenu Menu )

Argument

Description

controlname

The name of the RibbonApplicationButtonItem, RibbonTabButtonItem, RibbonLargeButtonItem, or RibbonSmallButtonItem control.

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 associates an application menu (which includes an "Account" master menu item and a "RecentMenu1" recent menu item) to the "MyApp" application button; and then gets and stores a copy of the application menu.

Integer li_Return
RibbonApplicationButtonItem lr_AppButton
RibbonApplicationMenu lr_AppMenu, lr_AppMenu2

lr_AppMenu.InsertMasterItemFirst ("Account", "AccountBig!", "ue_AccountMenuClicked")
lr_AppMenu.InsertRecentItemFirst ("RecentMenu1", "ue_RecentMenuClicked")
lr_AppButton.Text = "MyApp"
li_Return = lr_AppButton.SetMenu (lr_AppMenu)
If li_Return = 1 Then
 li_Return = rbb_1.SetApplicationButton (lr_AppButton)
 li_Return = lr_AppButton.GetMenu (lr_AppMenu2)
End If

Example 2

This example associates a ribbon menu (which includes an "Add" menu item) to the tab button; and then gets a copy of the ribbon menu.

Integer li_Return, li_Return2
RibbonTabButtonItem lr_TabButton
RibbonMenu lr_Menu, lr_Menu2

lr_Menu.InsertItemFirst ("Add", "AddSmall!", "Ue_AddMenuClicked")
li_Return = lr_TabButton.SetMenu (lr_Menu)
If li_Return = 1 Then
 li_Return2 = lr_TabButton.GetMenu (lr_Menu2)
End If

See also

SetMenu

GetMenuByButtonHandle