ToolButton.DropDownMenu

From Xojo Documentation

Property (As MenuItem )
aToolButton.DropDownMenu = newMenuItemValue
or
MenuItemValue = aToolButton.DropDownMenu

Supported for all project types and targets.

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

Example

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

DropDownButton = New ToolButton
DropDownButton.Style = ToolButton.ToolStyleDropDown
DropDownButton.Caption = "Cities"

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

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

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

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

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