Syntax 6: For Ribbon controls
Description
This is a user event which occurs when the user clicks on an item
within a 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, and
RibbonMenuItem)
Arguments for RibbonTabButtonItem,
RibbonLargeButtonItem, RibbonSmallButtonItem,
RibbonCheckBoxItem
|
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 |
|
SubIndex |
Long. The index of the submenu item clicked. 0 |
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 |
Return Values
Long.
Return code choices (specify in a RETURN statement):
0 — Continue processing
Examples
This example is a user event for a tab button. In this example,
the Ue_TabButtonClicked user event must be defined with a long parameter
for receiving the handle of TabButton where the mouse is
clicking.
|
1 2 3 4 5 6 7 8 9 10 11 |
RibbonTabButtonItem lr_TabButton lr_TabButton.Clicked = "Ue_TabButtonClicked" //Ue_TabButtonClicked user event must have a long parameter for receiving //the handle of TabButton where the mouse is clicking, as below event type long ue_tabbuttonclicked(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_MenuClicked 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 and sub menu. 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 |
//Ue_MenuClicked 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_menuclicked(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 menu. In this example, the Ue_MasterMenuClicked user event
must be defined with three Long parameters for receiving the handle of
the application button and the index numbers 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 |
//Ue_MasterMenuClicked user event must have three Long parameters for receiving the //handle of Application Button and the index numbers 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_mastermenuclicked(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_RecentMenuClicked 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_RecentMenuClicked user event must have two Long parameters for receiving the //handle of Application Button 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_recentmenuclicked(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