Introduction
Containers
Layouts
Widgets
Miscellaneous
|
Widgets -> combo
To create a combobox, use the following syntax:
$combo = combo(@data [, properties]);
The @data is an array (single dimension only) that will be the choices
shown in the combobox.
Properties
| Property | Arguments | Description | Example |
| command | subroutine name | This refers to the subroutine that will be performed when an item is selected. | $c = combo(@array, 'command=&subroutine') |
| editable | 1 or 0 | This makes the combobox items editable. | $c = combo(@array, 'editable=1'); |
| font | fontsize fontname | Self-explanatory. | - |
| fontstyle | BOLD, ITALIC or PLAIN | Self-explanatory. | - |
| tooltip | text | Self-explanatory. | - |
| fgcolor | COLOR | Self-explanatory. | - |
| bgcolor | COLOR | Self-explanatory. | - |
| width | Any integer | This specifies the width of the combobox. The number is based on character width. If width is not specified, your combo will be as wide as the widest item in it. | $c = combo(@array, 'width=15'); |
| bounds | x y w h | See Absolute Positioning for explanation of bounds. | - |
Functions
All these functions work for lists as well.
| Name and syntax |
Description |
| selectedIndex($combo) |
Returns selected index (a number).
(For a list, selectedIndices(list) would return an array
of the selected indices. This is not available in combo
because only one item can be selected at a time)
|
| getItem($combo, N) |
Returns Nth item in a combo listbox. |
| getSelectedItem($combo) |
Returns current selection. (For a list,
getSelectedItems(list) returns an array of the
selected items).
|
| addListItem($combo, item) |
Adds item to the combo. |
| insertListItem($combo, item, pos) |
Inserts item at position pos in the combo. |
| removeListItem($combo, N) |
Removes Nth item from the combo. |
| clearList($combo) |
Clears the combo (Removes all data). |
| listSize($combo) |
Returns total number of combo items. |
| select($combo, N) |
Selects Nth item. |
| selectv($combo, value) |
Selects matching value in the combo. |
| selectw($combo, wildcard) |
Selects first item that matches wildcard. |
| selectr($combo, regex) |
Selects first item that matches regular expression |
| setListData($combo, @array) |
Sets all the items in @array as the data of the combo. |
| getListData($combo) |
Returns an array of the combo items. |
- End of page -
|