WebControl.ContextualMenu

From Xojo Documentation

Revision as of 00:56, 9 June 2011 by Dbrandt (talk | contribs) (added example of contextual menu for 2011r2)

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.


Example

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

</rbcode>

 dim menu as New WebMenuItem
 
 menu.Append(New WebMenuItem("One"))
 menu.Append(New WebMenuItem("Two"))
 menu.Append(New WebMenuItem("Three"))
 me.ContextualMenu=menu

</rbcode>

The menu selection will be handled in the ContextualMenuAction event when the user right-clicks on the control. For example, it can be of the form:

Select case item.Text
case "One"
MsgBox "One"
case "Two"
MsgBox "Two"
case "Three"
MsgBox "Three"
end Select

There are parallel 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