ActionQMenu:
Filter:
Classes (extension) | GUI > Views | Libraries > jostMlib

ActionQMenu
ExtensionExtension

A Button with a popup Menu for performing actions.
Location: NOT INSTALLED!

Description

A Button with Menu for performing actions. Closes on unfocus or with esc key.

Supports Button or RoundButton as a button classes.

If wslib quark is active, defaults to RoundButton.

Closes on click outside or on escape.

Class Methods

.new

Create an ActionQMenu

Arguments:

parent

The parent view.

bounds

A Rect

name

The Menu Button Title

items

An Array of String, Association (\key->function), MenuAction, or ActionQSubMenu.

NOTE: items

Use a String to trigger the defaultAction (and globalAction).

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

MenuAction will give you the most customizability.

defaultAction

a default action for action items, in case no action is specified.

globalAction

a global action which is run for any item.

useDefaultFont

if your item is a , override its font with menu font. defaults to true. If you want to completely customize MenuAction items, set it to false;

showArrow

show a little down-tick arrow, defaults to true

Returns:

an ActionMenu

.newMenuOnly

Create an ActionQMenu without the trigger button, so you can attach the menu to MainMenu

See code examples below.

Arguments:

name

The Menu Button Title

items

An Array of String, Association (\key->function), MenuAction, or ActionQSubMenu.

NOTE: items

Use a String to trigger the defaultAction (and globalAction).

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

WARNING: When registering with MainMenu, "-" cannot be repeated without adding a unique name (which is not rendered)

MenuAction will give you the most customizability.

defaultAction

a default action for action items, in case no action is specified.

globalAction

a global action which is run for any item.

Returns:

an ActionMenu without the trigger button (for attaching to MainMenu)

.buttonClass

Default: Button.

but you can use the RoundButton from the wonderful wslib quark.

If wslib quark is active, defaults to RoundButton.

Returns:

the Button class.

Inherited class methods

Instance Methods

.defaultAction

a function. if you a add only a string, not an association, this function will be used.

.fontSize

.button

the menu Button

.menu

the Menu

.addItem

add an item: String, Association (\key->function), MenuAction.

MenuAction will give you the most customizability.

.insertItem

insert an item. before: A MenuAction or in index integer item: String, Association (\key->function), MenuAction. MenuAction will give you the most customizability.

.globalAction

a global function to be evaluated on selection

Returns:

(describe returnvalue here)

.toolTip

set a tooltip for the menu button

.arrowSize

default 6.5

.arrowColor

Inherited instance methods

Examples

NOTE: Items

Use a String to trigger the defaultAction (and globalAction).

If a String starts with "-", it creates a menu separator.

Use an Association to trigger the associated function (and globalAction).

Use a MenuAction to customize all aspects of the menu, and trigger the associated action (and globalAction).

Use a ActionQSubMenu to create a sub-menu.

Using with MainMenu

WARNING: When registering with MainMenu, "-" cannot be repeated without adding a unique name (which is not rendered)