From Xojo Documentation

Revision as of 23:50, 28 August 2019 by Gperlman (talk | contribs)

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.

Count fa-lock-32.png MenuID fa-lock-32.png Text
Enabled Tag
Append Clone Insert
Child FindItem Remove


Constructor(Text as String)

Constructor(Text as String, Tag as Variant)


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.

Sample Code

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

Var 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"
MessageBox("Item 1 selected.")
Case "Item 2"
MessageBox("Item 2 selected.")
End Select

This code create a nested menu:

Var b As New WebMenuItem

Var m1 As New WebMenuItem("Parent")
Var m2 As New WebMenuItem("Child")

Me.ContextualMenu = b

See Also

WebToolbar, WebToolbarMenu, classes; UserGuide:Web Menus topic