Contents Up Previous Next

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.

You can create a group of mutually-exclusive radio buttons by specifying wxRB_GROUP for the first in the group. The group ends when another radio button group is created, or there are no more radio buttons.

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 In some circumstances, radio buttons that are not consecutive siblings trigger a hang bug in Windows (only). If this happens, add this style to mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself.
wxRB_USE_CHECKBOX Use a checkbox button instead of radio button (currently supported only on PalmOS).

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

id

label

pos

size

style

validator

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