View Source wxRadioButton (wx v2.4.3)

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.

Styles

This class supports the following 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.

See:

This class is derived, and can use functions, from:

wxWidgets docs: wxRadioButton

Events

Event types emitted from this class:

Summary

Functions

Creates the choice for two-step construction.

Destroys the object

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

Default constructor.

Constructor, creating and showing a radio button.

Sets the radio button to checked or unchecked status.

Types

-type wxRadioButton() :: wx:wx_object().

Functions

Link to this function

create(This, Parent, Id, Label)

View Source
-spec create(This, Parent, Id, Label) -> boolean()
                when
                    This :: wxRadioButton(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Label :: unicode:chardata().

Equivalent to create(This, Parent, Id, Label, []).

-spec create(This, Parent, Id, Label, [Option]) -> boolean()
                when
                    This :: wxRadioButton(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Label :: unicode:chardata(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()} |
                        {validator, wx:wx_object()}.

Creates the choice for two-step construction.

See new/4 for further details.

-spec destroy(This :: wxRadioButton()) -> ok.

Destroys the object

-spec getValue(This) -> boolean() when This :: wxRadioButton().

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

-spec new() -> wxRadioButton().

Default constructor.

See: create/5

-spec new(Parent, Id, Label) -> wxRadioButton()
             when Parent :: wxWindow:wxWindow(), Id :: integer(), Label :: unicode:chardata().

Equivalent to new(Parent, Id, Label, []).

-spec new(Parent, Id, Label, [Option]) -> wxRadioButton()
             when
                 Parent :: wxWindow:wxWindow(),
                 Id :: integer(),
                 Label :: unicode:chardata(),
                 Option ::
                     {pos, {X :: integer(), Y :: integer()}} |
                     {size, {W :: integer(), H :: integer()}} |
                     {style, integer()} |
                     {validator, wx:wx_object()}.

Constructor, creating and showing a radio button.

See: create/5

-spec setValue(This, Value) -> ok when This :: wxRadioButton(), Value :: boolean().

Sets the radio button to checked or unchecked status.

This does not cause a wxEVT_RADIOBUTTON event to get emitted.

If the radio button belongs to a radio group exactly one button in the group may be checked and so this method can be only called with value set to true. To uncheck a radio button in a group you must check another button in the same group.

Note: Under MSW, the focused radio button is always selected, i.e. its value is true. And, conversely, calling SetValue(true) will also set focus to the radio button if the focus had previously been on another radio button in the same group - as otherwise setting it on wouldn't work.