## wxRadioButton

A radio button item is a button which usually denotes one of several mutually exclusive options. It has a text label next to a (usually) round button.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/radiobut.h>

Window styles

wxRB_GROUP | Marks the beginning of a new group of radio buttons.
wxRB_SINGLE | If your radio buttons are not consecutive siblings, they cannot form a group under Windows and you should use this style to indicate that each of them is handled individually.

See also window styles overview.

Event handling

EVT_RADIOBUTTON(id, func) | Process a wxEVT_COMMAND_RADIOBUTTON_SELECTED event, when the radiobutton is clicked.

See also

Event handling overview, wxRadioBox, wxCheckBox

Members

wxRadioButton::wxRadioButton
wxRadioButton::~wxRadioButton
wxRadioButton::Create
wxRadioButton::GetValue
wxRadioButton::SetValue

### wxRadioButton::wxRadioButton

wxRadioButton()

Default constructor.

wxRadioButton(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioButton")

Constructor, creating and showing a radio button.

Parameters

parent

Parent window. Must not be NULL.

id

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

label

Label for the radio button.

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.

style

Window style. See wxRadioButton.

validator

Window validator.

name

Window name.

See also

wxRadioButton::Create, wxValidator

### wxRadioButton::~wxRadioButton

void ~wxRadioButton()

Destructor, destroying the radio button item.

### wxRadioButton::Create

bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "radioButton")

Creates the choice for two-step construction. See wxRadioButton::wxRadioButton for further details.

### wxRadioButton::GetValue

bool GetValue() const

Returns TRUE if the radio button is depressed, FALSE otherwise.

### wxRadioButton::SetValue

void SetValue(const bool value)

Sets the radio button to selected or deselected status. This does not cause a wxEVT_COMMAND_RADIOBUTTON_SELECTED event to get emitted.

Parameters

value

TRUE to select, FALSE to deselect.