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 ArgumentsDescriptionExample
command subroutine nameThis refers to the subroutine that will be performed when an item is selected.$c = combo(@array, 'command=&subroutine')
editable 1 or 0This makes the combobox items editable.$c = combo(@array, 'editable=1');
font fontsize fontnameSelf-explanatory.-
fontstyleBOLD, ITALIC or PLAINSelf-explanatory.-
tooltip textSelf-explanatory.-
fgcolor COLORSelf-explanatory.-
bgcolor COLORSelf-explanatory.-
width Any integerThis 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 hSee 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 -
Hosted by www.Geocities.ws

1