A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons.
Derived from
wxControl
wxWindow
wxEvtHandler
wxObject
Include files
<wx/radiobox.h>
Window styles
wxRA_SPECIFY_ROWS | The major dimension parameter refers to the maximum number of rows. |
wxRA_SPECIFY_COLS | The major dimension parameter refers to the maximum number of columns. |
See also window styles overview.
Event handling
EVT_RADIOBOX(id, func) | Process a wxEVT_COMMAND_RADIOBOX_SELECTED event, when a radiobutton is clicked. |
See also
Event handling overview, wxRadioButton, wxCheckBox
Members
wxRadioBox::wxRadioBox
wxRadioBox::~wxRadioBox
wxRadioBox::Create
wxRadioBox::Enable
wxRadioBox::FindString
wxRadioBox::GetCount
wxRadioBox::GetLabel
wxRadioBox::GetSelection
wxRadioBox::GetStringSelection
wxRadioBox::GetString
wxRadioBox::Number
wxRadioBox::SetLabel
wxRadioBox::SetSelection
wxRadioBox::SetStringSelection
wxRadioBox::Show
wxRadioBox()
Default constructor.
wxRadioBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
wxRadioBox(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point, const wxSize& size, const wxArrayString& choices, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
Constructor, creating and showing a radiobox.
Parameters
parent
id
label
pos
size
n
choices
majorDimension
style
validator
name
See also
wxRadioBox::Create, wxValidator
wxPython note: The wxRadioBox 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.
~wxRadioBox()
Destructor, destroying the radiobox item.
bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& point, const wxSize& size, const wxArrayString& choices, int majorDimension = 0, long style = wxRA_SPECIFY_COLS, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioBox")
Creates the radiobox for two-step construction. See wxRadioBox::wxRadioBox for further details.
void Enable(bool enable = true)
Enables or disables the entire radiobox.
void Enable(int n, bool enable = true)
Enables or disables an individual button in the radiobox.
Parameters
enable
n
wxPython note: In place of a single overloaded method name, wxPython implements the following methods:
Enable(flag) | Enables or disables the entire radiobox. |
EnableItem(n, flag) | Enables or disables an individual button in the radiobox. |
int FindString(const wxString& string) const
Finds a button matching the given string, returning the position if found, or -1 if not found.
Parameters
string
int GetCount() const
Returns the number of items in the radiobox.
wxString GetLabel() const
Returns the radiobox label.
wxString GetLabel(int n) const
Returns the label for the given button.
Parameters
n
See also
wxPython note: In place of a single overloaded method name, wxPython implements the following methods:
GetLabel() | Returns the radiobox label. |
GetItemLabel(n) | Returns the label for the given button. |
int GetSelection() const
Returns the zero-based position of the selected button.
wxString GetStringSelection() const
Returns the selected string.
wxString GetString(int n) const
Returns the label for the button at the given position.
Parameters
n
int Number() const
Obsolescence note: This method is obsolete and was replaced with GetCount, please use the new method in the new code. This method is only available if wxWidgets was compiled with WXWIN_COMPATIBILITY_2_2 defined and will disappear completely in future versions.
Returns the number of buttons in the radiobox.
void SetLabel(const wxString& label)
Sets the radiobox label.
void SetLabel(int n, const wxString& label)
Sets a label for a radio button.
Parameters
label
n
wxPython note: In place of a single overloaded method name, wxPython implements the following methods:
SetLabel(string) | Sets the radiobox label. |
SetItemLabel(n, string) | Sets a label for a radio button. |
void SetSelection(int n)
Sets a button by passing the desired string position. This does not cause a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
Parameters
n
void SetStringSelection(const wxString& string)
Sets the selection to a button by passing the desired string. This does not cause a wxEVT_COMMAND_RADIOBOX_SELECTED event to get emitted.
Parameters
string
void Show(const bool show)
Shows or hides the entire radiobox.
void Show(int item, const bool show)
Shows or hides individual buttons.
Parameters
show
item
wxPython note: In place of a single overloaded method name, wxPython implements the following methods:
Show(flag) | Shows or hides the entire radiobox. |
ShowItem(n, flag) | Shows or hides individual buttons. |