Difference between revisions of "WebUIControl.ContextualMenuSelected"

From Xojo Documentation

 
Line 9: Line 9:
 
|text = Called when a contextual menu item is selected. This selected item is contained in ''hitItem''. }}
 
|text = Called when a contextual menu item is selected. This selected item is contained in ''hitItem''. }}
  
==Example==
+
==Sample Code==
This example populates a contextual menu in the Opening event of a [[WebToolbar]]:
+
This code populates a contextual menu in the Opening event of a [[WebToolbar]]:
  
 
<rbcode>
 
<rbcode>

Latest revision as of 13:17, 24 April 2020

Event


WebUIControl.ContextualMenuSelected(hitItem as WebMenuItem)

New in 2020r1

Supported for all project types and targets.

Called when a contextual menu item is selected. This selected item is contained in hitItem.

Sample Code

This code populates a contextual menu in the Opening event of a WebToolbar:

Var menu As New WebMenuItem

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

There are equivalent events and properties for managing contextual menus on WebPage as well.

See Also

WebMenuItem class.