WebMenuItem

From Xojo Documentation


For desktop applications, see MenuItem.

Class (inherits from None)


New in 2011r2

An item in a WebToolbarMenu or a contextual menu used in a web page or web control.

Properties
Count fa-lock-32.png MenuID fa-lock-32.png Text
Enabled Tag


Methods
Append Clone Remove
Child FindItem


Constructors

WebMenuItem.Constructor()


WebMenuItem.Constructor(Text as String)


WebMenuItem.Constructor(Text as String, Tag as Variant)


Notes

You can display a contextual menu in a web app by assigning the WebMenuItem to the WebControl.ContextualMenu property. When the user right+clicks on the control the contextual menu is displayed.

Examples

To add a contextual menu to a Button, add a this code to the Shown event handler:

Dim menu As New WebMenuitem

menu.Append(New WebMenuItem("Item 1"))
menu.Append(New WebMenuItem("Item 2"))

Me.ContextualMenu = menu

Right-click on the button to show the menu.

To determine which menu was selected, use this code in the ContextualMenuAction event handler:

Select Case Item.Text
Case "Item 1"
MsgBox("Item 1 selected.")
Case "Item 2"
MsgBox("Item 2 selected.")
End Select

See Also

WebToolbar, WebToolbarButton, WebToolbarContainer, WebToolbarFlexibleSpace, WebToolbarMenu, WebToolbarSeparator, WebToolbarSpace classes.