WebControl.ContextualMenu

From Xojo Documentation

For desktop applications, see RectControl.ConstructContextualMenu and RectControl.ContextualMenuAction.


Property (As WebMenuItem )
aWebControl.ContextualMenu = newWebMenuItemValue
or
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.

Notes

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

Examples

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"
MessageBox("One")
Case "Two"
MessageBox("Two")
Case "Three"
MessageBox("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

WebMenuItem