wxChoice

A choice item 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.

Derived from

wxControlWithItems
wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/choice.h>

Window styles

There are no special styles for wxChoice.

See also window styles overview.

Event handling

EVT_CHOICE(id, func) Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the list is selected.

See also

wxListBox, wxComboBox, wxCommandEvent



wxChoice::wxChoice



wxChoice(void)

Default constructor.



wxChoice(wxWindow * parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = ``choice")



wxChoice(wxWindow * parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = ``choice")

Constructor, creating and showing a choice.

Parameters

parent
Parent window. Must not be NULL.

id
Window identifier. A value of -1 indicates a default value.

pos
Window position.

size
Window size. If the default size (-1, -1) is specified then the choice is sized appropriately.

n
Number of strings with which to initialise the choice control.

choices
An array of strings with which to initialise the choice control.

style
Window style. See wxChoice.

validator
Window validator.

name
Window name.

See also

wxChoice::Create, wxValidator

wxPython での注意点: The wxChoice constructor in wxPython reduces the n and choices arguments are to a single argument, which is a list of strings.

wxPerl での注意点: In wxPerl there is just an array reference in place of n and choices.



wxChoice::~wxChoice



~wxChoice(void)

Destructor, destroying the choice item.



wxChoice::Create



bool Create(wxWindow * parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = ``choice")



bool Create(wxWindow * parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = ``choice")

Creates the choice for two-step construction. See wxChoice::wxChoice.



wxChoice::Delete



void Delete(int n)

Deletes the item with the given index from the control.

Parameters

n
The item to delete.



wxChoice::GetColumns

int GetColumns(void) const

Gets the number of columns in this choice item.

Remarks

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



wxChoice::SetColumns



void SetColumns(int n = 1)

Sets the number of columns in this choice item.

Parameters

n
Number of columns.

Remarks

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

ymasuda 平成17年11月19日