WebMenuItem.Constructor(Text as String)

From Xojo Documentation

Constructor


WebMenuItem.Constructor(Text as String)

New in 2011r2

Creates a new WebMenuItem with the passed text.

Example

The following example is in the Open event of a WebToolbar. The toolbar has a button called ChartsButton and another called DatesButton. In the Open event of the Toolbar, these items are populated with menus using the following code. After the last call to WebMenuItem.Append, the menu is attached to the appropriate button.

// Create the chart menu
Var chartMenu As New WebMenuItem
chartMenu.Append(New WebMenuItem("Line"))
chartMenu.Append(New WebMenuItem("Bar"))
chartMenu.Append(New WebMenuItem("Pie"))
chartMenu.Append(New WebMenuItem("-"))
chartMenu.Append(New WebMenuItem("3D Line"))
chartMenu.Append(New WebMenuItem("3D Bar"))
chartMenu.Append(New WebMenuItem("3D Pie"))
WebToolBarMenu(Me.ItemWithName("ChartsButton")).Menu = chartMenu

// Create the Dates menu
Var dateMenu As New WebMenuItem
dateMenu.Append(New WebMenuItem("Today"))
dateMenu.Append(New WebMenuItem("Tomorrow"))
dateMenu.Append(New WebMenuItem("Next Week"))
dateMenu.Append(New WebMenuItem("Next Month"))
WebToolBarMenu(Me.ItemWithName("DatesButton")).Menu = dateMenu