PopUpMenu:
Filter:
Classes | GUI > Views

PopUpMenu : ItemViewBase : View : QObject : Object

A view displaying a text item selectable from a drop-down menu.
Subclasses: QPopUpMenu

Description

When clicked, this view opens a menu containing several text items, then closes the menu and displays one of the items after it is selected.

Class Methods

Inherited class methods

Undocumented class methods

PopUpMenu.qtClass

Instance Methods

Data

.items

.items = stringArray

From superclass: ItemViewBase

The list of items displayed in a menu when the view is clicked.

Arguments:

stringArray

An Array of Strings or Symbols.

.clear

From superclass: ItemViewBase

Removes all items.

.item

From superclass: ItemViewBase

The currently selected item.

Returns:

A String.

.value

.value = val

The index of the currently selected item.

Arguments:

val

An integer, or nil meaning no selected item.

.valueAction = val

From superclass: ItemViewBase

Sets -value and triggers -action.

Arguments:

val

An integer, or nil meaning no selected item.

Appearance

.stringColor

.stringColor = color

The color used to display text.

Arguments:

color

A Color.

.background

.background = color

Setting this variable colors the area of the view under the text with the given color.

Arguments:

color

A Color.

Interaction

.allowsReselection

.allowsReselection = flag

Determines whether the action is triggered when selecting already selected item. Defaults to false.

Arguments:

flag

A Boolean.

Actions

.action

.action = func

From superclass: View

The action object evaluated whenever the user changes the selected item from the menu. See -allowsReselection for customization.

Drag and drop

.defaultGetDrag

Returns:

The -value.

.defaultCanReceiveDrag

Returns:

True if the current drag data is a number.

.defaultReceiveDrag

Sets -valueAction to the current drag data.

Inherited instance methods

Examples

Basic Example

Sound Example

Play different functions: