wxRadioButton(3)
π wxRadioButton
okay so bestie, welcome to wxRadioButton β this is the Erlang Module Definition for it, and it's genuinely one of the cutest little widgets in wx. a radio button item is a button which usually denotes one of several mutually exclusive options. that's the whole ~vibe~ honestly: pick exactly one, girl. π
β¨ DESCRIPTION β¨
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.
β οΈ lowkey important: that hang bug is Windows-only and it will legit hang you. if your buttons are non-consecutive siblings and things freeze, that's why. wxRB_SINGLE is the rescue. π
See:
- Overview events
wxRadioBoxwxCheckBox
This class is derived, and can use functions, from:
wxControlwxWindowwxEvtHandler
wxWidgets docs: wxRadioButton
π¦ Events
Event types emitted from this class:
command_radiobutton_selected
π DATA TYPES π
wxRadioButton() :: wx:wx_object().
π FUNCTIONS π
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.
destroy(This :: wxRadioButton()) -> ok.
Destroys the object. bye bestie, it was iconic while it lasted π«Ά
getValue(This) -> boolean() when This :: wxRadioButton().
Returns true if the radio button is checked, false otherwise. simple as. β¨
new() -> wxRadioButton().
Default constructor.
See: create/5
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
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. for real, no event, don't go waiting for one π
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 istrue. And, conversely, callingSetValue(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.
so yeah, on MSW the focus and the check state are kind of glued together. that's not a bug, that's just how it is. periodt. π
mwah, that's the whole page bestie π this iconic little manual was brought to you by Ericsson AB, living under the wx 2.6 banner, and it's filed as wxRadioButton(3). now go make some mutually exclusive choices, main character. π¦πΈ
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms