A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field.
A combobox permits a single selection only. Combobox items are numbered from zero.
CB_SIMPLE |
Creates a combobox with a permanently displayed list. Windows only. |
CB_DROPDOWN |
Creates a combobox with a drop-down list. |
CB_READONLY |
Same as CB_DROPDOWN but only thestrings specified as the combobox choices can be selected, it is impossible toselect (even from a program) a string which is not in the choices list. |
CB_SORT |
Sorts the entries in the list alphabetically. |
TE_PROCESS_ENTER |
The control will generatethe event EVT_COMMAND_TEXT_ENTER (otherwise pressing Enter keyis either processed internally by the control or used for navigation betweendialog controls). Windows only. |
See also window styles overview.
| evt_combobox(id) { | event | ... } | Process a EVT_COMMAND_COMBOBOX_SELECTED event,when an item on the list is selected. Note that callingget_value returns the new value of selection. |
| evt_text(id) { | event | ... } | Process a EVT_COMMAND_TEXT_UPDATED event,when the combobox text changes. |
| evt_text_enter(id) { | event | ... } | Process a EVT_COMMAND_TEXT_ENTER event,when |
ListBox, TextCtrl, Choice, CommandEvent
ComboBox.new(Window parent, Integer id, String value,
Point pos,
Size size,
Array choices,
Integer style = 0,
Validator validator = DEFAULT_VALIDATOR,
String name = "comboBox")
Constructor, creating and showing a combobox.
Boolean create(Window parent, Integer id, String value,
Point pos,
Size size,
ArrayString choices,
Integer style = 0,
Validator validator = DEFAULT_VALIDATOR,
String name = "comboBox")
Creates the combobox for two-step construction. Derived classes should call or replace this function. See ComboBox.new for further details.
Boolean can_copy()
Returns true if the combobox is editable and there is a text selection to copy to the clipboard.
Only available on Windows.
Boolean can_cut()
Returns true if the combobox is editable and there is a text selection to copy to the clipboard. Only available on Windows.
Boolean can_paste()
Returns true if the combobox is editable and there is text on the clipboard that can be pasted into the text field. Only available on Windows.
Boolean can_redo()
Returns true if the combobox is editable and the last undo can be redone. Only available on Windows.
Boolean can_undo()
Returns true if the combobox is editable and the last edit can be undone. Only available on Windows.
copy()
Copies the selected text to the clipboard.
cut()
Copies the selected text to the clipboard and removes the selection.
Integer get_current_selection()
This function does the same things as Choice#get_current_selection and returns the item currently selected in the dropdown list if it’s open or the same thing as get_selection otherwise.
Integer get_insertion_point()
Returns the insertion point for the combobox’s text field.
Note: Under MSW, this function always returns 0 if the combobox doesn’t have the focus.
TextPos get_last_position()
Returns the last position in the combobox text field.
Integer from, Integer to = get_text_selection_range()
This is the same as TextCtrl#get_selection for the text control which is part of the combobox, returning the start and end position of the text selection.
Currently this method is only implemented in MSW and GTK.
String get_value()
Returns the current value in the combobox text field.
paste()
Pastes text from the clipboard to the text field.
redo()
Redoes the last undo in the text field. Windows only.
replace(Integer from, Integer to, String text)
Replaces the text between two positions with the given text, in the combobox text field.
remove(Integer from, Integer to)
Removes the text between the two positions in the combobox text field.
set_insertion_point(Integer pos)
Sets the insertion point in the combobox text field.
set_insertion_point_end()
Sets the insertion point at the end of the combobox text field.
set_text_selection_range(Integer from, Integer to)
Selects the text between the two positions, in the combobox text field.
set_value(String text)
Sets the text for the combobox text field.
NB: For a combobox with CB_READONLY style the string must be in
the combobox choices list, otherwise the call to SetValue() is ignored.
undo()
Undoes the last edit in the text field. Windows only.
[This page automatically generated from the Textile source at Thu May 01 00:50:34 +0100 2008]