Introduction
Containers Layouts Widgets Miscellaneous

Widgets -> list

To create a listbox, use the following syntax:

$list = list(@data [, properties]);

The @data is an array (single dimension only) that will be the choices shown in the listbox.

Properties

Property ArgumentsDescriptionExample
command subroutine nameThis refers to the subroutine that will be performed when an item is selected.$c = list(@array, 'command=&subroutine')
font fontsize fontnameSelf-explanatory.-
fontstyleBOLD, ITALIC or PLAINSelf-explanatory.-
tooltip textSelf-explanatory.-
fgcolor COLORSelf-explanatory.-
bgcolor COLORSelf-explanatory.-
size w hSpecifies (w)idth and (h)eight of the list-
vsbar 1 or 01 means show vertical scrollbar always.-
hsbar 1 or 01 means show horizontal scrollbar always.-
selectmode SINGLE_SELECTION, SINGLE_INTERVAL or MULTIPLE_INTERVAL SINGLE_SELECTION Only one item can be selected at a time. When the user selects an item, any previously selected item is deselected first. This is the default value.

SINGLE_INTERVAL Multiple, contiguous items can be selected. When the user begins a new selection range, any previously selected items are deselected first.

MULTIPLE_INTERVAL Any combination of items can be selected at once. The user must explicitly deselect items.
-
bounds x y w hSee Absolute Positioning for explanation of bounds.-

Functions

All these functions work for combo boxes as well.

Name and syntax Description
selectedIndex($list) Returns selected index (a number).
selectedIndices($list) Returns an array of the selected indices.
getItem($list, N) Returns Nth item in a listbox.
getSelectedItem($list) Returns current selection.
getSelectedItems($list) Returns an array of the selected items.
addListItem($list, item) Adds item to the list.
insertListItem($list, item, pos) Inserts item at position pos in the list.
removeListItem($list, N) Removes Nth item from the list.
clearList($list) Clears the list (Removes all data).
listSize($list) Returns total number of list items.
select($list, N) Selects Nth item.
selectv($list, value) Selects matching value in the list.
selectw($list, wildcard) Selects first item that matches wildcard.
selectr($list, regex) Selects first item that matches regular expression
deselect($list) Deselects any list selection.
setListData($list, @array) Sets all the items in @array as the data of the list.
getListData($list) Returns an array of the list items.
- End of page -
Hosted by www.Geocities.ws

1