new ListBox(propsopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
props |
object.<string, *> |
<optional> |
{}
|
Extends
Methods
draw()
- Source:
- Inherited From:
- See:
Draw the widget in the associated window
get_header() → {string}
- Source:
Get header text
Returns:
- Type
- string
get_header_draw_mode() → {DrawMode}
- Source:
Get header draw mode
Returns:
- Type
- DrawMode
get_items() → {Array.<string>}
- Source:
Get items
Returns:
- Type
- Array.<string>
get_items_draw_mode() → {DrawMode}
- Source:
Get items draw mode
Returns:
- Type
- DrawMode
get_page_size() → {number}
- Source:
Get number of visible items that fit in the list
Returns:
- Type
- number
get_selected_draw_mode() → {DrawMode}
- Source:
Get selected item draw mode. Note that selected draw mode is computed as the reverse of the items draw mode, thus it cannot be set.
Returns:
- Type
- DrawMode
get_selected_index() → {number}
- Source:
Get the index of the selected item (starting at 0)
Returns:
- Type
- number
get_selected_item() → {string}
- Source:
Get the value of the selected item
Returns:
- Type
- string
get_size() → {WindowSize}
- Source:
- Inherited From:
Return underlying window size
Returns:
- Type
- WindowSize
get_win() → {Window}
- Source:
- Inherited From:
Get associated window
Returns:
- Type
- Window
go_end()
- Source:
Select last item
Fires:
go_home()
- Source:
Select first item
Fires:
go_next()
- Source:
Select next item
Fires:
go_next_page()
- Source:
Select item one page down
Fires:
go_prev()
- Source:
Select previous item
Fires:
go_prev_page()
- Source:
Select item one page up
Fires:
invalidate()
- Source:
- Inherited From:
Invalidate window contents, i.e.: mark widget as modified so that next drawing cycle refreshes screen contents.
is_disabled() → {boolean}
- Source:
- Inherited From:
Check whether the widget is disabled.
Returns:
- Type
- boolean
merge_keymap(map)
- Source:
- Inherited From:
- See:
Merge some key mappings with current active keymap
Example
widget.merge_keymap([
tui.KEY_UP, 'go_up',
tui.KEY_DOWN, 'go_down',
]);
Parameters:
Name | Type | Description |
---|---|---|
map |
Array | An array of alternating key number, function name elements. |
send_key(key) → {boolean}
- Source:
- Inherited From:
- See:
Send a key to the widget so that it is processed according to the active keymap.
Parameters:
Name | Type | Description |
---|---|---|
key |
number | Key code |
Returns:
Returns true if the key was processed
- Type
- boolean
set_disabled(disabled)
- Source:
- Inherited From:
- See:
Disable widget so that it won't receive any keyboard input at all from module:wui.send_key.
Parameters:
Name | Type | Description |
---|---|---|
disabled |
boolean |
set_header(header)
- Source:
Set header text
Parameters:
Name | Type | Description |
---|---|---|
header |
string |
set_header_draw_mode(header_draw_mode)
- Source:
Set header draw mode
Parameters:
Name | Type | Description |
---|---|---|
header_draw_mode |
DrawMode |
set_items(items)
- Source:
Set items
Parameters:
Name | Type | Description |
---|---|---|
items |
Array.<string> |
Fires:
set_items_draw_mode(items_draw_mode)
- Source:
Set items draw mode
Parameters:
Name | Type | Description |
---|---|---|
items_draw_mode |
DrawMode |
set_keymap(map)
- Source:
- Inherited From:
- See:
Overwrite current active keymap with new key mappings
Example
widget.set_keymap([
tui.KEY_UP, 'go_up',
tui.KEY_DOWN, 'go_down',
]);
Parameters:
Name | Type | Description |
---|---|---|
map |
Array | An array of alternating key number, function name elements. |
set_listeners(listeners)
- Source:
- Inherited From:
Overwrite current listeners map with a new map
Parameters:
Name | Type | Description |
---|---|---|
listeners |
object.<string, WidgetListener> |
set_selected_index(index)
- Source:
Set selected item by index (starting at 0)
Parameters:
Name | Type | Description |
---|---|---|
index |
number |
Fires:
set_win(win)
- Source:
- Inherited From:
Set associated window object. Note that this function invalidates the window contents so that it is cleared on next redraw.
Parameters:
Name | Type | Description |
---|---|---|
win |
Window |
Events
selected_item_changed
- Source: