Classes | GUI > EZ-GUI

EZLists : EZGui : Object

An abstract superclass for EZListView and EZPopUpMenu
Source: EZgui.sc
Subclasses: EZListView, EZPopUpMenu

Description

Users will not normally directly create instances of EZLists, but only use it through its subclasses. It provides the basic mechanisms for EZListView and EZPopUpMenu.

Class Methods

EZLists.new(parentView, bounds, label, items, globalAction, initVal: 0, initAction: false, labelWidth, labelHeight: 20, layout, gap, margin)

Inherited class methods

Instance Methods

Building and Changing the List

.globalAction

.globalAction = value

Set/get the global function to be performed in addition to the item functions: { arg listObj; value }.

.items

.items = assocArray

Set/get an Array of Associations including the labels and the item functions: ['label' -> { arg listObj; value }, ].

Discussion:

In menus, the macOS graphics system gives special meanings to some characters. See PopUpMenu ; Or and Array Symbols (if you are only using globalAction). Arrays of Symbols will get converted into and array of Associations with and empty Function ['label' -> {}, ].

.item

Returns:

the item label of the current selection.

.itemFunc

Returns:

the item function of the current selection.

.addItem(name, action)

Adds an item.

Arguments:

name

An instance of String or Symbol. The name of the list/menu item.

action

An instance of Function.

.insertItem(index, name, action)

Inserts a list/menu item at index position.

Arguments:

index

An Integer. The index where to insert an item.

name

An instance of String or Symbol. The name of the list/menu item.

action

An instance of Function.

.replaceItemAt(index, name, action)

Replace a list/menu item at index position.

Arguments:

index

An Integer. The index where to insert an item.

name

An instance of String or Symbol. The name of the list/menu item. Default is the current item label.

action

An instance of Function. Default is the current item action.

.removeItemAt(index)

Removes a list/menu item at index position.

Arguments:

index

An Integer. The index where to remove an item.

.remove

From superclass: EZGui

Removes both the view, label and the list/menu from the parent view.

Accessing Values

.value

.value = val

Gets/sets the list/menu to the index at value. Does not perform the action.

Arguments:

val

An Integer.

.valueAction = val

Sets the value and performs the action at the index value and the global action.

Arguments:

val

An Integer.

.doAction

Performs the action at the current index and the global action.

.initViews

Called by init and overridden by all subclasses. This is where the class specific views are built.

Inherited instance methods