wxRuby Documentation Home

Wx::Choice

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.

Derived from

ControlWithItems

Control

Window

EvtHandler

Object

Window styles

There are no special styles for Choice.

See also window styles overview.

Event handling

evt_choice(id) { | event | ... } Process a EVT_COMMAND_CHOICE_SELECTED event,when an item on the list is selected.

See also

ListBox, ComboBox, CommandEvent

Methods

Choice.new

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.

Parameters

See also

Choice#create, Validator

Choice#create

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.

Choice#delete

delete(Integer n)

Deletes the item with the given index from the control.

Parameters

Choice#get_columns

Integer get_columns()

Gets the number of columns in this choice item.

Remarks

This is implemented for Motif only and always returns 1 for the other platforms.

Choice#get_current_selection

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.

Choice#set_columns

set_columns(Integer n = 1)

Sets the number of columns in this choice item.

Parameters

Remarks

This is implemented for Motif only and doesn’t do anything under other platforms.

[This page automatically generated from the Textile source at Wed Sep 09 02:21:02 +0100 2009]