-
Notifications
You must be signed in to change notification settings - Fork 0
RadioButton
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
}
| 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.
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.
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 worth knowing:
- 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 — it
behaves like a checkbox that cannot be unchecked by clicking. That is almost
never what is wanted; if a radio button appears not to exclude its neighbours,
a missing or misspelled group= is the first thing to check.
The same as Button: Space and Return select, a click selects,
and it takes focus by Tab and by click.
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.
CheckBox · Button · ComboBox — the same choice as a list · Common Properties
KittyTK — image/tty Trinket Kit · MIT licensed · alpha, 0.1.x
Repository · Issues · Support on ko-fi
Sibling projects: PurfecTerm (terminal emulator) · mew (text editor) · PawScript (language)
Getting Started
Installation Building from Source Running a Display Host Your First Application Examples
Protocol
Protocol Overview Object Model Properties and Values Events Templates and Aliases Common Properties Introspection Transports and Security
Clients
Go Client Python Client C Client
Application Objects
Application · MenuBar · Window · MessageBox
Output Trinkets
Label · ProgressBar · StatusBar
Input Trinkets
TextInput · Editor · Terminal
Button · CheckBox · RadioButton
ListView · ComboBox · TreeView
Layout Trinkets
TabTrinket · Panel
ScrollArea · MDIPane
Separator · Spacer · Splitter
Other Trinkets
Layout Helpers