Contents Up Previous Next

Choice

A choice item is similar to a single-selection listbox but normally only the current selection is displayed. It must be the child of a panel.

choice-create
choice-append
choice-find-string
choice-clear
choice-get-selection
choice-get-string-selection
choice-set-selection
choice-set-string-selection
choice-get-string
choice-number


choice-create

long ( choice-create long panel-id string callback string label
optional long x optional long y optional long width optional long height
optional multifield strings optional string style optional string name)

Creates a choice item on the given panel. A choice consists of a list of strings, one of which may be selected and displayed at any one time. The callback may be the empty string ("'') to denote no callback, or a word or string for the function name. The function will be called when an item in the choice list is selected, with the choice ID as argument. If no position is given, the panel item is placed after the last item. The value -1 may be passed to denote a default, so that the position may be left unspecified and the size given.

strings should be a multifield of strings. Note that under Motif, it is recommended that the values are passed in this function, rather than using choice-append, because of the nature of Motif (i.e. horrible). Otherwise, things are likely to be messed up.

The style parameter is reserved for future use.

name gives the choice item a name that can be retrieved with window-get-name.


choice-append

long ( choice-append long choice-id string item)

Append the string item to the choice.


choice-find-string

long ( choice-find-string long choice-id string item)

Searches for the given string and if found, returns the position ID of the string.


choice-clear

long ( choice-clear long choice-id)

Clears all the strings from the choice item.


choice-get-selection

long ( choice-get-selection long choice-id)

Get the ID of the string currently selected.


choice-get-string-selection

string ( choice-get-string-selection long choice-id)

Get the string currently selected.


choice-set-selection

long ( choice-set-selection long choice-id long item-id)

Sets the choice selection to the given item ID (numbered from zero).


choice-set-string-selection

long ( choice-set-string-selection long choice-id string item)

Set the selection by passing the appropriate item string.


choice-get-string

string ( choice-get-string long choice-id long item-id)

Get the string associated with the given item ID.


choice-number

long ( choice-number long choice-id)

Returns the number of strings in the choice item.