From Xojo Documentation

Revision as of 23:51, 28 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
For desktop applications, see RectControl.ConstructContextualMenu and RectControl.ContextualMenuAction.

Property (As WebMenuItem )
aWebControl.ContextualMenu = newWebMenuItemValue
WebMenuItemValue = aWebControl.ContextualMenu

New in 2011r2

Supported for all project types and targets.

If you assign a WebMenuItem to the control, it will be displayed when the user right-clicks the control.


You can also display the contextual menu by calling WebControl.PresentContextualMenu.


This example populates a contextual menu in the Shown event of the control.

Var menu As New WebMenuItem
menu.Append(New WebMenuItem("One"))
menu.Append(New WebMenuItem("Two"))
menu.Append(New WebMenuItem("Three"))

Me.ContextualMenu = menu

The menu selection calls the WebControl.ContextualMenuAction event handler when the user right-clicks on the control. For example, it can be of the form:

Select Case item.Text
Case "One"
Case "Two"
Case "Three"
End Select

There are equivalent events and properties for managing contextual menus on the WebPage for use when you want to display a contextual menu in response to a right-click on the web page.

See Also