Contents Up Previous Next

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

Members

wxChoice::wxChoice
wxChoice::~wxChoice
wxChoice::Create
wxChoice::Delete
wxChoice::GetColumns
wxChoice::SetColumns


wxChoice::wxChoice

wxChoice()

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

id

pos

size

n

choices

style

validator

name

See also

wxChoice::Create, wxValidator

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

wxPerl note: In wxPerl there is just an array reference in place of n and choices.


wxChoice::~wxChoice

~wxChoice()

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 wxString& name = "choice")

bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style = 0, 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


wxChoice::GetColumns

int GetColumns() 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

Remarks

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