DesktopBevelButton.Menu

From Xojo Documentation

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

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

New in 2021r3

Supported for all project types and targets.

The button's drop-down menu.

Sample Code

This code in the Opening event handler of a DesktopBevelButton adds a menu to it. The first menu item is numbered zero.

Var months() As String = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
Me.Caption = "Month"
Me.CaptionAlignment = DesktopBevelButton.CaptionAlignments.Left
Me.MenuStyle = DesktopBevelButton.MenuStyles.Right

Var myMenu As New DesktopMenuItem
For Each m As String In months
myMenu.AddMenu(New DesktopMenuItem(m))
Next

Me.Menu = myMenu

This code in the MenuSelected event handler displays the selected menu:

MessageBox(selectedItem.Text)