WebUIControl.ContextualMenu
From Xojo Documentation
Property (As WebMenuItem )
aWebUIControl.ContextualMenu = newWebMenuItemValue
or
WebMenuItemValue = aWebUIControl.ContextualMenu
New in 2020r1
Supported for all project types and targets.
or
WebMenuItemValue = aWebUIControl.ContextualMenu
New in 2020r1
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
On a WebPage, you can disable/remove the default contextual menu by an empty WebMenuItem class object to this property.
Sample Code
This code populates a contextual menu in the Shown event of the control.
Var menu As New WebMenuItem
menu.AddMenuItem("One")
menu.AddMenuItem("Two")
menu.AddMenuItem("Three")
Me.ContextualMenu = menu
menu.AddMenuItem("One")
menu.AddMenuItem("Two")
menu.AddMenuItem("Three")
Me.ContextualMenu = menu
The menu selection is then handled by the ContextualMenuSelected event when the user right-clicks on the control. For example, it can be of the form:
Select case hitItem.Value
Case "One"
MessageBox("One")
Case "Two"
MessageBox("Two")
Case "Three"
MessageBox("Three")
End Select
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 WebPage as well.
See Also
WebMenuItem class, and Desktop RectControl.ConstructContextualMenu and RectControl.ContextualMenuAction events.