From Xojo Documentation

Revision as of 20:40, 18 December 2021 by Gperlman (talk | contribs) (Notes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

DesktopWindow.ContextualMenuItemSelected(HitItem as DesktopMenuItem) As Boolean

New in 2021r3

Supported for all project types and targets.

Fires when a contextual DesktopMenuItem HitItem was selected but the MenuItemSelected event and the MenuHandler for the DesktopMenuItem did not handle the menu selection.


This event gives you a chance to handle the menu selection by inspecting the menuitem’s Value or Tag properties to see which item was selected. Use this in conjunction with ConstructContextualMenu if you have not specified the MenuItemSelected 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 DesktopMenuItem is passed in as a parameter.

base.Add(New DesktopMenuItem("Import"))
base.Add(New DesktopMenuItem("Export"))
Return True // display the contextual menu

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

Select Case hititem.Text
Case "Import"
MessageBox("You chose Import")
Case "Export"
MessageBox("You chose export")
End Select

Return True