Syntax 1: For Ribbon controls
Description
This is a user event which occurs when the user highlights an item
within the RibbonBar control.
Make sure the parameter (quantities and types) of the user event
is correctly defined according to the requirement of the ribbon
control.
Applies to
Ribbon controls (including RibbonTabButtonItem,
RibbonLargeButtonItem, RibbonSmallButtonItem, RibbonCheckBoxItem,
RibbonComboBoxItem, and RibbonMenuItem)
Arguments for RibbonTabButtonItem,
RibbonLargeButtonItem, RibbonSmallButtonItem, RibbonCheckBoxItem,
RibbonComboBoxItem
|
Argument |
Description |
|---|---|
|
ItemHandle |
Long. The handle of the item. |
Arguments for RibbonMenuItem (of Normal(0)
type)
|
Argument |
Description |
|---|---|
|
ItemHandle |
Long. The handle of the button the menu is |
|
Index |
Long. The index of the menu item the mouse is |
|
SubIndex |
Long. The index of the submenu item the mouse is |
Arguments for RibbonMenuItem (of Recent(2)
type)
|
Argument |
Description |
|---|---|
|
ItemHandle |
Long. The handle of the button the menu is |
|
Index |
Long. The index of the menu item the mouse is |
Return Values
Long.
Return code choices (specify in a RETURN statement):
0 — Continue processing
Example
This example is a user event for a tab button. In this example,
the Ue_TabButtonSelected user event must be defined with a long
parameter for receiving the handle of the tab button where the mouse is
hovering.
|
1 2 3 4 5 6 7 8 9 10 11 |
RibbonTabButtonItem lr_TabButton lr_TabButton.Selected = "Ue_TabButtonSelected" //Ue_TabButtonSelected user event must have a long parameter for receiving //the handle of TabButton where the mouse is hovering, as below event type long ue_tabbuttonselected(long itemhandle); RibbonTabButtonItem lr_TabButton rbb_1.GetTabButton(ItemHandle,lr_TabButton) //... Return 1 end event |
This example is a user event for a menu item in the ribbon menu.
In this example, the Ue_MenuSelected user event must be defined with
three long parameters for receiving the handle of the tab/large/small
button and the index numbers of the menu item and submenu item. Each
menu item can be bound with different events or the same event.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//Ue_MenuSelected user event must have three long parameters for receiving the //handle of Tab/Large/Small Button and the index number of the menu and //sub menu. Each MenuItem can bind with different events or the same event. //In the following example, the same event is bound to get RibbonMenu: event type long ue_menuselected(long itemhandle, long index, long subindex); Integer li_Return RibbonMenu lr_Menu RibbonMenuItem lr_MenuItem li_Return = rbb_1.GetMenuByButtonHandle(ItemHandle, lr_Menu) If li_Return = 1 Then If SubIndex = 0 Then li_Return = lr_Menu.GetItem(Index, lr_MenuItem) //... Else li_Return = lr_Menu.GetItem(Index, SubIndex, lr_MenuItem) //... End If Else Return 0 End If Return 1 end event |
This example is a user event for a master menu item in the
application button. In this example, the Ue_MasterMenuSelected user
event must be defined with three Long parameters for receiving the
handle of the application button and the index number of the master menu
item and submenu item. Each menu item can be bound with different events
or the same event.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//Ue_MasterMenuSelected user event must have three Long parameters for receiving //the handle of Application Button and the index number of the master menu and //sub menu. Each MenuItem can bind with different events or the same event. //In the following example, the same event is bound to get RibbonApplicationMenu: event type long ue_mastermenuselected(long itemhandle, long index, long subindex); Integer li_Return RibbonApplicationMenu lr_Menu RibbonMenuItem lr_MenuItem li_Return = rbb_1.GetMenuByButtonHandle(ItemHandle, lr_Menu) If li_Return = 1 Then If SubIndex = 0 Then li_Return = lr_Menu.GetMasterItem(Index, lr_MenuItem) //... Else li_Return = lr_Menu.GetMasterItem(Index, SubIndex, lr_MenuItem) //... End If Else Return 0 End If Return 1 end event |
This example is a user event for the recent menu item in the
application menu. In this example, the Ue_RecentMenuSelected user event
must be defined with two Long parameters for receiving the handle of the
application button and the index number of the recent menu item. Each
menu item can be bound with different events or the same event.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
//Ue_RecentMenuSelected user event must have two Long parameters for receiving //the handle of ApplicationButton and the index number of Recent //Menu. Each MenuItem can bind with different events or the same event. //In the following example, the same event is bound to get RibbonApplicationMenu. event type long ue_recentmenuselected(long itemhandle, long index); Integer li_Return RibbonApplicationMenu lr_Menu RibbonMenuItem lr_MenuItem li_Return = rbb_1.GetMenuByButtonHandle(ItemHandle,lr_Menu) If li_Return = 1 Then li_Return = lr_Menu.GetRecentItem(Index,lr_MenuItem) //... Else Return 0 End If Return 1 end event |
See also