EZListView:
Filter:
Classes | GUI > EZ-GUI

EZListView

A wrapper class for a label plus a listView with per item actions
Location: NOT INSTALLED!

Description

EZListView is wrapper class which creates an (optional) label and a listView. It includes per item actions as well as a global action which are both evaluated upon selection of an item. Convenience methods for inserting and deleting list items are also included . If the parent is nil, then EZListView will create its own window. See EZGui and EZLists for all of the options.

Some Important Issues Regarding EZListView

The convenience methods for EZListView require that the items array is an array of associations of labels and functions, not like in ListView, where items is simply an array of strings. If label is nil, then no staticText is created.

Class Methods

Creation / Class Methods

.new

Arguments:

parentView

The parent view or window. If the parent is nil, then EZListView will create its own Window, and place it conveniently on the screen if the bounds are a Point. If the bounds are a Rect, then the Rect determines the window bounds.

bounds

An instance of Rect or Point. Default value is 160@200.

label

The label. Default value is nil. If nil, then no StaticText is created.

items

Default value is nil. An Array of Associations ['label' -> { arg listObj; value }, ]. Or and Array Symbols (if you are only using globalAction).

globalAction

A global function to be performed in addition to the item functions { arg listObj; value }.

initVal

Initial value of the List, i.e. the index selected. Default value is 0.

initAction

An instance of Boolean. Performs the action at initVal on creation of the list, plus the globalAction. Default value is false.

labelWidth

Default value is 80. Not used if layout is \vert.

labelHeight

Default value is 20. Not used if layout is \horz.

layout

\vert or \horz. default is \vert.

gap

A Point. By default, the view tries to get its parent's gap, otherwise it defaults to 2@2. Setting it overrides these.

margin

A Point. This will inset the bounds occupied by the subviews of view.

Discussion:

Example:

Inherited class methods

Instance Methods

Changing Appearance

.setColors

Arguments:

stringBackground

An instance of Color. The background of the label and unit views.

stringColor

An instance of Color. The stringColor of the label and unit views.

listBackground

An instance of Color. The background of the list view.

listStringColor

An instance of Color. The stringColor of the list view.

selectedStringColor

An instance of Color. The selectedStringColor of the listView.

hiliteColor

An instance of Color. The hiliteColor of the list view.

background

An instance of Color. The background of the list view.

.font

Set the Font used by all the views.

Arguments:

font

An instance of Font.

Inherited instance methods

Examples

Creates its own window if parent is nil:

Layout horizontal:

No labelView created, so set the window title:

insert item:

remove item:

replace item: