From Xojo Documentation


Window.ContextualMenuAction(HitItem as MenuItem) As Boolean

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.


The following code in a ConstructContextualMenu event builds a simple contextual menu. The parameter Base as MenuItem is passed in as a parameter.

base.append(New MenuItem("Import"))
base.append(New MenuItem("Export"))
Return True // display the contextual menu

The following Select statement in the ContextualMenuAction event handler inspects the selected menu item, which is passed in as the HitItem as MenuItem parameter.

Select Case hititem.Text
Case "Import"
MsgBox "You chose Import"
Case "Export"
MsgBox "You chose export"
End Select

Return True