class TUI::MultiOptionListView

Overview

Multi-select option list for the dropdown picker. Space toggles the focused row's membership, independent of cursor movement (same interaction FlagsField already uses inline). Enter means "confirm the whole current selection" rather than "pick this one row and close" — a different signal than single-select's on_activate, so it's reported via a dedicated #on_confirm property instead of overloading on_activate's one-index payload.

Selection is tracked by wire_value, not by list index — a filtered row's index shifts as the filter changes, so indices are never a stable identity for "is this option selected"; only the option's own wire_value is.

Defined in:

tui/widgets/option_list.cr

Constructors

Instance Method Summary

Instance methods inherited from class TUI::ListView

content_size : Int32 content_size, cursor_focused_style : Style cursor_focused_style, cursor_focused_style=(cursor_focused_style : Style) cursor_focused_style=, cursor_unfocused_style : Style cursor_unfocused_style, cursor_unfocused_style=(cursor_unfocused_style : Style) cursor_unfocused_style=, filter_active? : Bool filter_active?, filter_prompt_style : Style filter_prompt_style, filter_prompt_style=(filter_prompt_style : Style) filter_prompt_style=, handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool handle_click, handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool handle_key, header_rows : Int32 header_rows, on_activate : Proc(Int32, Nil) | Nil on_activate, on_activate=(on_activate : Proc(Int32, Nil) | Nil) on_activate=, on_select : Proc(Int32, Nil) | Nil on_select, on_select=(on_select : Proc(Int32, Nil) | Nil) on_select=, reload : Nil reload, render_content(buffer : Buffer, scroll : ScrollControl) : Nil render_content, row_content(index : Int32) : String row_content, selected_index : Int32 | Nil selected_index, status_hint : String status_hint, title : String title, title_style : Style title_style, title_style=(title_style : Style) title_style=

Constructor methods inherited from class TUI::ListView

new(source : ListDataSource) new

Macros inherited from class TUI::ListView

scroll(header) scroll

Instance methods inherited from module TUI::Scrollable

content_size : Int32 content_size, focus_if(condition : Bool) : Nil focus_if, focused=(focused : Bool) focused=, focused? : Bool focused?, handle_click(local_row : Int32, local_col : Int32, scroll : ScrollControl) : Bool handle_click, handle_key(ev : KeyEvent, scroll : ScrollControl) : Bool handle_key, header_rows : Int32 header_rows, render_content(buffer : Buffer, scroll : ScrollControl) : Nil render_content, status_hint : String status_hint, title : String title

Constructor Detail

def self.new(option_source : OptionListSource, initial : Set(String) = Set(String).new) #

[View source]

Instance Method Detail

def on_confirm : Proc(Set(String), Nil) | Nil #

Fires on Enter with the full current selection's wire_values (see #selected_wire_values) — the "confirm this whole set" signal described above, kept separate from ListView#on_activate.


[View source]
def on_confirm=(on_confirm : Proc(Set(String), Nil) | Nil) #

Fires on Enter with the full current selection's wire_values (see #selected_wire_values) — the "confirm this whole set" signal described above, kept separate from ListView#on_activate.


[View source]
def row_content(index : Int32) : String #
Description copied from class TUI::ListView

The content string for content-row index, before the leading " {pointer}" prefix and before width-fitting/highlight styling (those stay in render_content, shared by every subclass).


[View source]
def selected_wire_values : Set(String) #

[View source]
def status_hint : String #

[View source]