ToolbarButton.Menu

From Xojo Documentation

Property (As MenuItem )
aToolbarButton.Menu = newMenuItemValue
or
MenuItemValue = aToolbarButton.Menu

New in 2019r2

Supported for all project types and targets.

The menu that is used with a button of style DropDown or SeparateDropDown. Use the ButtonStyle property to set the type of button.

Example

This example is in the ToolbarButton example discussed on the page for this class. This code is in the Initialized event of the ToolbarButton. It builds the menu, attaches it to a DropDownButton, and adds it to the toolbar.

DropDownButton = New ToolbarButton
DropDownButton.ButtonStyle = ToolbarButton.ButtonStyles.DropDown
DropDownButton.Caption = "Cities"

// create a menu
Var myMenu As New MenuItem
Var myMenuItem1 As New MenuItem
Var myMenuItem2 As New MenuItem
Var myMenuitem3 As New MenuItem

DropDownButton.Name = "Cities Menu"
myMenu.Text = "Cities"

myMenuItem1.Text = "Grand Blanc"
myMenuItem2.Text = "Bad Axe"
myMenuitem3.Text = "Flint"
myMenu.Add(myMenuItem1)
myMenu.Add(myMenuItem2)
myMenu.Add(myMenuItem3)

// assign the new menu to the toolitem..
DropDownButton.DMenu = myMenu

// add to the toolbar
Me.Add(DropDownButton)