howl.ui.ListWidget

Overview

ListWidget is a widget containing a selection list. It displays a list of options with one option highlighted - the selected item. A ListWidget is primarily used to display a selection list attached to the command line. For example, the interact.select interaction uses the ListWidget to display a selection list.

ListWidget handles keystrokes bound to the ‘cursor-up’, ‘cursor-down’, ‘cursor-page-up’ and ‘cursor-page-down’ commands to change the currently selected item. The default keystrokes bound to these commands are the up, down , pgup and pgdn keys respectively. This widget also provides an API to get the currently selected item and update the items in the list.


See also:

Constructor

ListWidget (matcher, opts={})

Creates a new ListWidget.

Properties

.columns

A table specifying a header and styles for each column. The schema of this table is identical to the columns argument in the StyledText.for_table function. Read/write.

.items

A table contining the items currently displayed. Read-only.

.max_height

The maximum height for the widget, in pixels. The height is rounded down to the closest multiple of the line height. The widget is never taller than this height. If the items don’t fit within the height, paging is enabled. Read/write.

.min_height

The minimum height for the widget, in pixels. The height is rounded down to the closest multiple of the line height. The widget is never shorter than this height. If the items don’t fill up the height, the filler text is displayed on each line to fill the extra space. Read/write.

.selected

The currently selected item. Read/write.

.showing

true when the widget is currently showing or false when hidden. Read-only.

Methods

hide ()

Hides the widget.

show ()

Shows the widget.

update (search_text)

Updates the list of displayed items to the items returned by calling matcher(search_text). See matcher in the constructor above.