Combobox¶
Combobox is derived from Control class.
[lide.widgets] ^1.0lide.widgets.controls.combobox 1.0
The Combobox control is used to display data in a drop-down combo box. By default, the Combobox control appears in two parts: the top part is a text box that allows the user to type a list item. The second part is a list box that displays a list of items from which the user can select one.
Constructor¶
Combobox class has a complex constructor:
object Combobox:new {
object Parent, string Name,
table Choices = { "item 1", "item 2", "item3" }
}
Events¶
The following events are emitted by this class:
| Event name | Description |
|---|---|
| Widget.onEnter | When the mouse moves onto this widget. |
| Widget.onLeave | When the mouse moves out to this widget. |
| Combobox.onSelected_ | When an item on the list is selected or the selection changes. |
Inherited Methods¶
These methods are inherited from its super classes:
| Class Method | Description |
|---|---|
| Object:getName | Returns object’s name. |
| Object:setName | Sets the object name. |
| Widget:getParent | Returns object’s parent. |
| Widget:setParent | Sets the object parent. |
| Widget:getPosX | Returns object’s position related to X. |
| Widget:setPosX | Sets the object position related to X. |
| Widget:getPosY | Returns object’s position related to Y. |
| Widget:setPosY | Sets the object position related to Y. |
| Widget:getWidth | Returns object’s width. |
| Widget:setWidth | Sets the object width. |
| Widget:getHeight | Returns object’s height. |
| Widget:setHeight | Sets the object height. |
| Widget:getBind | Returns the wxWidgets object. |
Class Methods¶
These methods are defined by this class.
Combobox:getText¶
Returns the current value in the combobox text field.
| string | Combobox: getText ( ) |
Combobox:setChoices¶
Set the current choices in the Combobox.
| nil | Combobox:setChoices ( table tChoices ) |
Combobox:setSelection¶
Sets the selection to the given item nSelect.
Note that this does not cause any command events to be emitted nor
does it deselect any other items in the controls which support multiple selections.
| nil | Combobox:setSelection( number nSelect ) |
Combobox:getSelection¶
Returns the index of the selected item orwx.wxNOT_FOUNDif noitem is selected.
Returns: The position of the current selectionThis method can be used with single selection list boxes only, you should use
Listbox:getSelections()for the listboxes withLB_MULTIPLEstyle.
| number | Combobox:getSelection() |
Combobox:findItem¶
Finds and returns a reference to a ListItem object in a Comboboxcontrol.
| number | Combobox:findItem( number nItem ) |