#include <wx/choice.h>
A choice item is used to select one of a list of strings.
Unlike a wxListBox, only the selection is visible until the user pulls down the menu of choices.
This class supports the following styles:
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros for events emitted by this class:
![]() | ![]() | ![]() |
wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
wxChoice () | |
Default constructor. | |
wxChoice (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxChoiceNameStr) | |
Constructor, creating and showing a 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=wxChoiceNameStr) | |
Constructor, creating and showing a choice. | |
virtual | ~wxChoice () |
Destructor, destroying the choice item. | |
virtual int | GetColumns () const |
Gets the number of columns in this choice item. | |
virtual int | GetCurrentSelection () const |
Unlike wxControlWithItems::GetSelection() which only returns the accepted selection value, i.e. | |
virtual void | SetColumns (int n=1) |
Sets the number of columns in this choice item. | |
bool | Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxChoiceNameStr) |
Creates the choice for two-step construction. | |
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=wxChoiceNameStr) |
Creates the choice for two-step construction. |
wxChoice::wxChoice | ( | ) |
Default constructor.
wxChoice::wxChoice | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
int | n = 0 , |
|||
const wxString | choices[] = NULL , |
|||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxChoiceNameStr | |||
) |
Constructor, creating and showing a choice.
parent | Parent window. Must not be NULL. | |
id | Window identifier. The value wxID_ANY indicates a default value. | |
pos | Window position. If wxDefaultPosition is specified then a default position is chosen. | |
size | Window size. If wxDefaultSize 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. |
wxPython Note:
The wxChoice constructor in wxPython reduces the n and choices arguments to a single argument, which is a list of strings.
wxPerl Note: Not supported by wxPerl.
wxChoice::wxChoice | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos, | |||
const wxSize & | size, | |||
const wxArrayString & | choices, | |||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxChoiceNameStr | |||
) |
Constructor, creating and showing a choice.
parent | Parent window. Must not be NULL. | |
id | Window identifier. The value wxID_ANY indicates a default value. | |
pos | Window position. | |
size | Window size. If wxDefaultSize is specified then the choice is sized appropriately. | |
choices | An array of strings with which to initialise the choice control. | |
style | Window style. See wxChoice. | |
validator | Window validator. | |
name | Window name. |
wxPython Note:
The wxChoice constructor in wxPython reduces the n and choices arguments to a single argument, which is a list of strings.
wxPerl Note: Use an array reference for the choices parameter.
virtual wxChoice::~wxChoice | ( | ) | [virtual] |
Destructor, destroying the choice item.
bool wxChoice::Create | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos, | |||
const wxSize & | size, | |||
const wxArrayString & | choices, | |||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxChoiceNameStr | |||
) |
Creates the choice for two-step construction.
See wxChoice().
bool wxChoice::Create | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
int | n = 0 , |
|||
const wxString | choices[] = NULL , |
|||
long | style = 0 , |
|||
const wxValidator & | validator = wxDefaultValidator , |
|||
const wxString & | name = wxChoiceNameStr | |||
) |
Creates the choice for two-step construction.
See wxChoice().
virtual int wxChoice::GetColumns | ( | ) | const [virtual] |
Gets the number of columns in this choice item.
virtual int wxChoice::GetCurrentSelection | ( | ) | const [virtual] |
Unlike wxControlWithItems::GetSelection() 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.
virtual void wxChoice::SetColumns | ( | int | n = 1 |
) | [virtual] |
Sets the number of columns in this choice item.
n | Number of columns. |
![]() |
[ top ] |