From Xojo Documentation


RectControl.ContextualMenuAction(hitItem as MenuItem) As Boolean

New in 2005r1

Supported for all project types and targets.

Fires when a contextual menuitem hitItem was selected but the Action event and the MenuHandler for the menuitem did not handle the menu selection.


This event gives you a chance to handle the menu selection by inspecting the menuitem's Text or Tag properties to see which item was selected. Use this in conjunction with ConstructContextualMenu if you have not specified the Action event or the Menu Handler for the items on the contextual menu. See the example of a contextual menu in the examples for the RectControl class.

Sample Code

This simple event handler displays the text of the selected menu item.

If hitItem <> Nil Then MsgBox(hitItem.Text)
Return True

A more fine-grained event handler would compare the value of hitItem to all the expected values and take different actions depending on its value.