A choice item (also often called a ‘dropdown’) is used to select one of a list of strings. Unlike a listbox, only the selection is visible until the user pulls down the menu of choices. By using the client_data functions inherited from ControlWithItems , ruby objects can be associated with items within the dropdown.
There are no special styles for Choice.
See also window styles overview.
| evt_choice(id) { | event | ... } | Process a EVT_COMMAND_CHOICE_SELECTED event,when an item on the list is selected. |
ListBox, ComboBox, CommandEvent
Choice.new(Window parent, Integer id, Point pos,
Size size,
Array choices[],
Integer style = 0,
Validator validator = DEFAULT_VALIDATOR,
String name = "choice")
Constructor, creating and showing a choice.
Boolean create(Window parent, Integer id, Point pos,
Size size,
Array choices[],
Integer style = 0,
Validator validator = DEFAULT_VALIDATOR,
String name = "choice")
Creates the choice for two-step construction. See Choice.new.
delete(Integer n)
Deletes the item with the given index from the control.
Integer get_columns()
Gets the number of columns in this choice item.
This is implemented for Motif only and always returns 1 for the other
platforms.
Integer get_current_selection()
Unlike get_selection which only returns the accepted selection value, i.e. the selection in the control once the user closes the dropdown list, this function returns the current selection. That is, while the dropdown list is shown, it returns the currently selected item in it. When it is not shown, its result is the same as for the other function.
set_columns(Integer n = 1)
Sets the number of columns in this choice item.
This is implemented for Motif only and doesn’t do anything under other platforms.
[This page automatically generated from the Textile source at Thu May 01 00:50:34 +0100 2008]