wxRadioBox

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.
wxRA_USE_CHECKBOX Use of the checkbox controls instead of radio buttons (currently supported only on PalmOS)

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



wxRadioBox::wxRadioBox



wxRadioBox(void)

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
Parent window. Must not be NULL.

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

label
Label for the static box surrounding the radio buttons.

pos
Window position. If the position (-1, -1) is specified then a default position is chosen.

size
Window size. If the default size (-1, -1) is specified then a default size is chosen.

n
Number of choices with which to initialize the radiobox.

choices
An array of choices with which to initialize the radiobox.

majorDimension
Specifies the maximum number of rows (if style contains wxRA_SPECIFY_ROWS) or columns (if style contains wxRA_SPECIFY_COLS) for a two-dimensional radiobox.

style
Window style. See wxRadioBox.

validator
Window validator.

name
Window name.

See also

wxRadioBox::Create, wxValidator

wxPython での注意点: The wxRadioBox 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.



wxRadioBox::~wxRadioBox



~wxRadioBox(void)

Destructor, destroying the radiobox item.



wxRadioBox::Create



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.



wxRadioBox::Enable



virtual bool Enable(bool enable = true)

Enables or disables the entire radiobox.



virtual bool Enable(int n, bool enable = true)

Enables or disables an individual button in the radiobox.

Parameters

enable
true to enable, false to disable.

n
The zero-based button to enable or disable.

wxPython での注意点: In place of a single overloaded method name, wxPython implements the following methods:

2cm
Enable(flag) Enables or disables the entire radiobox.
EnableItem(n, flag) Enables or disables an individual button in the radiobox.

See also

wxWindow::Enable



wxRadioBox::FindString

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
The string to find.



wxRadioBox::GetCount

int GetCount(void) const

Returns the number of items in the radiobox.



wxRadioBox::GetLabel

wxString GetLabel(void) const

Returns the radiobox label.

Parameters

n
The zero-based button index.

See also

wxRadioBox::SetLabel

wxPython での注意点: In place of a single overloaded method name, wxPython implements the following methods:

2cm
GetLabel() Returns the radiobox label.
GetItemLabel(n) Returns the label for the given button.



wxRadioBox::GetSelection

int GetSelection(void) const

Returns the zero-based position of the selected button.



wxRadioBox::GetStringSelection

wxString GetStringSelection(void) const

Returns the selected string.



wxRadioBox::GetString

wxString GetString(int n) const

Returns the label for the button at the given position.

Parameters

n
The zero-based button position.



wxRadioBox::Number

int Number(void) 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.



wxRadioBox::SetLabel



void SetLabel(const wxString& label)

Sets the radiobox label.

Parameters

label
The label to set.

n
The zero-based button index.

wxPython での注意点: In place of a single overloaded method name, wxPython implements the following methods:

2cm
SetLabel(string) Sets the radiobox label.
SetItemLabel(n, string) Sets a label for a radio button.



wxRadioBox::SetSelection



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
The zero-based button position.



wxRadioBox::SetStringSelection



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
The label of the button to select.



wxRadioBox::Show



virtual bool Show(const bool show = true)

Shows or hides the entire radiobox.



virtual bool Show(int item, const bool show = true)

Shows or hides individual buttons.

Parameters

show
true to show, false to hide.

item
The zero-based position of the button to show or hide.

Return value

true if the box or item has been shown or hidden or false if nothing was done because it already was in the requested state.

See also

wxWindow::Show

wxPython での注意点: In place of a single overloaded method name, wxPython implements the following methods:

2cm
Show(flag) Shows or hides the entire radiobox.
ShowItem(n, flag) Shows or hides individual buttons.

ymasuda 平成17年11月19日