class TUI::OptionListView

Overview

Single-select option list for the dropdown picker — Enter (handled by ListView's own nav-mode Enter case) fires on_activate with the picked row's index INTO THE CURRENTLY FILTERED LIST — callers must resolve it via option_source.option_at(index), never by indexing their own original (unfiltered) options array directly, since the index is only meaningful relative to whatever's filtered right now.

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) #

[View source]

Instance Method Detail

def option_source : OptionListSource #

[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 seek(index : Int32) : Nil #

Moves the cursor to index — call after #reload, since #reload always resets the cursor to 0 when it repopulates the filtered list from the source.


[View source]