From Xojo Documentation
|You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!|
| This item was deprecated in version 2021r3.
Please use DesktopPopupMenu as a replacement.
Supported PlatformsProject Types: Desktop Platforms: macOS, Windows, Linux
- For web apps, see WebPopupMenu.
Displays a list of items when clicked. The user can select one item from the list. The ComboBox control is similar except that the user also has the option of typing an item instead of choosing one from the list of items.
Use the constant NoSelection (-1) to indicate that no rows are selected.
|Changing the Height property has no effect for apps run on macOS. As a native control, macOS always draws the PopupMenu at its system-standard height.|
|The MouseDown and MouseUp event handlers are never called on Linux due to a limitation of the underlying GtkComboBox that is used. |
|ContextualMenus do not work with PopupMenu on macOS due to a limitation of the underlying macOS control that is used.|
This code in the Open event handler populates a popup menu and sets the initial value to the current month:
For Each m As String In months
Var d As New Date
Me.SelectedRowIndex = d.Month - 1 // Select current month
Examine the value of SelectedRowIndex in the Change event handler to determine which item was selected.
This code adds an item to PopupMenu:
This code populates the RowTag identifier with a sequence number:
Then compare recID to another Integer.
This code opens a new window when an item is chosen.
Var w As ListEditorWindow
If PopupMenu1.Value = "Edit List..." Then
w = New ListEditorWindow
Changing the selected item in a PopupMenu:
Displaying the RowTag of the selected menu item: