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
Arguments for RibbonMenuItem (of Normal(0) type)
Argument |
Description |
---|---|
ItemHandle |
Long. The handle of the button the menu is associated with. |
Index |
Long. The index of the menu item the mouse is on. |
SubIndex |
Long. The index of the submenu item the mouse is on. 0 indicates the event is triggered by the main menu. |
Arguments for RibbonMenuItem (of Recent(2) type)
Argument |
Description |
---|---|
ItemHandle |
Long. The handle of the button the menu is associated with. |
Index |
Long. The index of the menu item the mouse is on. |
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.
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.
//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.
//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.
//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
Description
Occurs when the user highlights an item on the menu using the arrow keys or the mouse, without choosing it to be executed.
Event ID
Arguments
None
Return Values
None. (Do not use a RETURN statement.)
Usage
You can use the Selected event to display MicroHelp for the menu item. One way to store the Help text is in the menu item's Tag property.
Examples
This example uses the tag value of the current menu item to display Help text. The function wf_SetMenuHelp takes the text passed (the tag) and assigns it to a MultiLineEdit control. A Timer function and the Timer event are used to clear the Help text.
This code in the Selected event calls the function that sets the text:
w_test.wf_SetMenuHelp(This.Tag)
This code for the wf_SetMenuHelp function sets the text in the MultiLineEdit mle_menuhelp; its argument is called menuhelpstring:
mle_menuhelp.Text = menuhelpstring Timer(4)
This code in the Timer event clears the Help text and stops the timer:
w_test.wf_SetMenuHelp("") Timer(0)
See also