DesktopToolbarButton.Menu

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As DesktopMenuItem )
aDesktopToolbarButton.Menu = newDesktopMenuItemValue
or
DesktopMenuItemValue = aDesktopToolbarButton.Menu

New in 2021r3

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 DesktopToolbarButton example discussed on the page for this class. This code is in the Opening event of a DesktopToolbar. It builds the menu, attaches it to a DropDownButton, and adds it to the toolbar.

DropDownButton = New DesktopToolbarButton
DropDownButton.ButtonStyle = DesktopToolbarButton.ButtonStyles.DropDownMenu
DropDownButton.Caption = "Cities"

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

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

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

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

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