Skip to content

Modern Tui TuiRadioGroup

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Terminal TUI Library › Input Widgets › TuiRadioGroup

TuiRadioGroup

Draws a set of options where one is chosen, stored in your own variable.

Syntax

type TuiRadioGroup extends TuiWidget
    as TuiStringArray options
    as int32 ptr selected        '' CALLER-OWNED
    as TuiStyle normal, focused_, activeStyle
    as boolean horizontal, useUnicode
end type

Description

One-of-N. Like the checkbox it points at your own variable. activeStyle is COMPOSED over the widget background with Patch, not assigned -- assigning it once made a focused group highlight every option except the selected one.

Example

#import "std/numeric"
#import "std/tui"
using tui, numeric

dim as int32 choice
dim as TuiTheme th = TuiThemeDefault( )

dim as TuiRadioGroup rg
rg.options.Push( "small" )
rg.options.Push( "medium" )
rg.options.Push( "large" )
rg.selected = @choice
rg.normal = th.normal
rg.focused_ = th.selected
rg.activeStyle = th.accent
rg.SetFocused( TRUE )

dim as TuiEvent e
e.kind = TUIEVENT_KEY : e.key.code = TUIKEY_DOWN
rg.HandleEvent( e )
print choice                      '' 1 -- medium

See also

TuiTextInput TuiTextInput.SelectionStart TuiTextInput.Insert TuiTextAreaStateInit
TuiTextInputState TuiTextInput.SelectionEnd TuiTextArea TuiCheckbox
TuiTextInputStateInit TuiTextInput.DeleteSelection TuiTextAreaState TuiSelect

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Input Widgets
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally