wxRuby Documentation Home

# Wx::RadioButton

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 `RB_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

Control

Window

EvtHandler

Object

## Window styles

`RB_GROUP` | Marks the beginning of a new group of radio buttons.
`RB_SINGLE` | In some circumstances, radio buttons that are notconsecutive siblings trigger a hang bug in Windows (only). If this happens, add this styleto mark the button as not belonging to a group, and implement the mutually-exclusive group behaviour yourself.
`RB_USE_CHECKBOX` | Use a checkbox button instead of radiobutton (currently supported only on PalmOS).

See also window styles overview.

## Event handling

evt_radiobutton(id) { | event | … } | Process a EVT_COMMAND_RADIOBUTTON_SELECTED event,when the radiobutton is clicked.

## See also

Event handling overview, RadioBox, CheckBox

## Methods

- RadioButton.new
- RadioButton#create
- RadioButton#get_value
- RadioButton#set_value

### RadioButton.new

RadioButton.new(%(arg-type)Window% parent, Integer id, String label, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String 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 RadioButton.
- validator Window validator.
- name Window name.

#### See also

RadioButton#create, Validator

destructor()

Destructor, destroying the radio button item.

### RadioButton#create

Boolean create(%(arg-type)Window% parent, Integer id, String label, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String name = “radioButton”)

Creates the choice for two-step construction. See RadioButton.new for
further details.

### RadioButton#get_value

Boolean get_value()

Returns true if the radio button is depressed, false otherwise.

### RadioButton#set_value

set_value(%(arg-type)Boolean% value)

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

#### Parameters

- value true to select, false to deselect.

[This page automatically generated from the Textile source at 2023-06-09 00:45:33 +0000]