Skip to content

RadioButton

phroun edited this page Aug 22, 2026 · 2 revisions

Wire name radiobutton

One of a set of mutually exclusive choices. Selecting one clears the others in its group.

p=new panel layout=vbox children={
	new radiobutton caption="Left"   group=justify checked
	new radiobutton caption="Center" group=justify
	new radiobutton caption="Right"  group=justify
}

Properties

Property Type Default Meaning
caption string Radio button label text.
checked flag false Whether this button is selected.
group word Radio group membership.
wrap flag false Word-wrap the label.

Plus the common properties.

Events

toggle — The selected state changed. Selecting one button in a group unsets its siblings, so a group change raises this on more than one button.

Field Type Meaning
trinket uint The radio button's object ID.
checked flag The new state.

One user action raises this more than once. Selecting a button clears its previously selected sibling, and that sibling reports its own change — so a group of three produces a toggle with checked unset, and one with it set. Handle the set one and ignore the rest, or track the group by which button last reported checked.

Groups are a name, not a container

group= is a plain word. Buttons that share it on the same connection exclude one another — no wrapper trinket, no reliance on being siblings:

new radiobutton caption="Left"  group=justify
new panel children={
	new radiobutton caption="Right" group=justify    # different parent, same group
}

The groups live in the connection, which has two consequences:

  • Scope is the connection. Two applications, or two connections from one application, cannot collide on a group name.
  • Position does not matter. Grouping is not inferred from layout, so moving a button between panels does not silently change what it excludes.

A button with no group= belongs to no group and excludes nothing, behaving like a checkbox that cannot be unchecked by clicking. A radio button that does not exclude its neighbours has a missing or misspelled group=.

Keys and mouse

The same as Button: Space and Return select, a click selects, and it takes focus by Tab and by click.

Behavior

No action=. Unlike Button and CheckBox, a radio button has no action= property and never raises command. A choice among options is a state to read when something else is invoked, not a command in itself.

Wrapping. wrap word-wraps the label.

Accessibility. Role RadioButton, with the selected state reported.

See also

CheckBox · Button · ComboBox — the same choice as a list · Common Properties

Clone this wiki locally