class

Opal::UI::RadioSet

Inherits Opal::UI::Control < Opal::UI::InputHookable < Opal::UI::Element < Opal::UI::Themable < Reference < Object

Group container for mutually exclusive radio choices inspired by Python Textual's RadioSet. Features arrow key navigation, space/enter activation, mouse clicks, and custom glyph swaps.

Constructors

new(items : Array(String | RadioButton), selected_index : Int32 | Nil = 0, horizontal : Bool = false, disabled : Bool = false, on_change : Proc(Int32, String, Nil) | Nil = nil)
Source
new(items : Array(String | RadioButton), selected_index : Int32 | Nil = 0, horizontal : Bool = false, disabled : Bool = false, &block : Int32, String -> Nil) : RadioSet
Source

Instance methods

active_border_fg

Manipulable theme properties

Source
active_border_fg=(active_border_fg : Color | Nil)

Manipulable theme properties

Source
buttons
Source
buttons=(buttons : Array(RadioButton))
Source
cursor

Focused index within the radio set

Source
cursor=(cursor : Int32)

Focused index within the radio set

Source
disabled=(disabled : Bool)
Source
disabled?
Source
handle_key(event : Terminal::KeyEvent) : Bool

Default key event handler. Override in subclasses if not using @default_input_proc.

Source
handle_mouse(event : Terminal::MouseEvent) : Bool

Default mouse event handler. Override in subclasses if not using @default_input_proc.

Source
horizontal=(horizontal : Bool)
Source
horizontal?
Source
item_spacing
Source
item_spacing=(item_spacing : Int32)
Source
on_change
Source
on_change
Source
on_change=(on_change : Proc(Int32, String, Nil) | Nil)
Source
preferred_size(available_w : Int32, available_h : Int32) : Tuple(Int32, Int32)
Source
render(buffer : Buffer, x : Int32, y : Int32, width : Int32, height : Int32) : Nil
Source
select_by_label(label : String) : self
Source
select_index(idx : Int32, fire_callback : Bool = true) : self

Selects radio button at given index, deselecting others

Source
selected_index

Returns the index of the currently selected button, or nil if none

Source
selected_label

Returns the label of the currently selected button, or nil if none

Source