Module vSearchField

Text input that allows you to search among pre-defined entries (auto-complete) .

#

## About

An auto-completing text widget + popup menu shows matching entries (if any) - a bit like the familiar browser address bar.

Note: press return to select the currently matched item, if any.

## TODO

* FIXME set index_observable to 0 when match is not complete * FIXME input text partially obscured (when setting programmatically) * FIXME long 'initial text' can exceed view width (check with many items) * FIXME error when setting index while having some input text

Functions

update () [[
auto_resize () overridden method
get_initial_chars ()
match_item () match item, display first match as text and all matches in popup called as text is entered, and widget obtains/looses focus
display_items (t) prefix items with 'none' entry
match_items ()
lost_focus () loosing focus is when we finalize the match (set the index or clear) (typing was completed with a return, or we clicked elsewhere)
set_index (val) Getters & Setters

Fields

self.items table, items to search through
self.popup boolean, decide if we should show a popup menu
self.case_sensitive [TODO] boolean, determine if matching is case sensitive
self.selected_index number, active index (set when focus is lost with a matched index)
self._matched_items table, all items matching user input (nil if no match)
self._vb_textfield viewbuilder components


Functions

update ()
[[
auto_resize ()
overridden method

Returns:

    table
get_initial_chars ()

Returns:

    table
match_item ()
match item, display first match as text and all matches in popup called as text is entered, and widget obtains/looses focus
display_items (t)
prefix items with 'none' entry

Parameters:

  • t

Returns:

    table, all items matching input string
match_items ()

Returns:

    table, all items matching input string
lost_focus ()
loosing focus is when we finalize the match (set the index or clear) (typing was completed with a return, or we clicked elsewhere)
set_index (val)
Getters & Setters

Parameters:

  • val

Fields

self.items
table, items to search through
self.popup
boolean, decide if we should show a popup menu
self.case_sensitive
[TODO] boolean, determine if matching is case sensitive
self.selected_index
number, active index (set when focus is lost with a matched index)
self._matched_items
table, all items matching user input (nil if no match)
self._vb_textfield
viewbuilder components
generated by LDoc 1.4.2