Lysa.ui  0.0
Lysa 3D Engine
DropDownList Class Referenceabstract

Detailed Description

A button displaying the selected item of a list, opening a popup list when clicked. Fires OnSelectItem.

Inherits from: Widget

Lua full name: lysa.ui.DropDownList

Public Member Functions

integer add_item (label: string)
 Adds an item at the end of the list and returns its 0-based index. More...
 
nil set_items (items: string[])
 Replaces all the items of the list. More...
 
nil set_items (items: string[], selected: string)
 Replaces all the items of the list and selects the given one. More...
 
nil remove_all_items ()
 Removes all the items of the list. More...
 
string get_item (index: integer)
 Returns the label of the item at the given index, or an empty string. More...
 
integer index_of (label: string)
 Returns the index of the first item with the given label, or -1. More...
 
nil select (index: integer)
 Selects the item at the given index, -1 removes the selection. More...
 
nil select (label: string)
 Selects the first item with the given label. More...
 
nil open ()
 Opens the popup list. More...
 
nil close ()
 Closes the popup list. More...
 
nil set_resources (res_button: string, res_arrow: string, res_list: string)
 Reloads the visual style: res_button = button, res_arrow = arrow, res_list = popup list. More...
 

Properties

integer count
 The number of items in the list. (read-only)
 
string[] items
 The labels of all the items, in display order. (read-only)
 
integer selected_index
 Index of the selected item, or -1 if none is selected. (read-only)
 
string selected_item
 Label of the selected item, or an empty string. (read-only)
 
string place_holder
 Text displayed by the button when no item is selected.
 
boolean is_open
 True while the popup list is displayed. (read-only)
 
integer max_displayed_items
 Maximum number of items displayed at once by the popup list.
 
number arrow_width
 Width of the arrow drawn at the right of the button.
 
Button button
 The clickable button displaying the selected item. (read-only)
 
Text label
 The text widget displaying the selected item. (read-only)
 
Arrow arrow
 The arrow displaying the open state. (read-only)
 
string list_resource
 Resource string used to style the popup list.
 

Member Function Documentation

integer add_item ( string  label)

Adds an item at the end of the list and returns its 0-based index.

Parameters
labelstring
Returns
integer
nil set_items ( string[]  items)

Replaces all the items of the list.

Parameters
itemsstring[]
nil set_items ( string[]  items,
string  selected)

Replaces all the items of the list and selects the given one.

Parameters
itemsstring[]
selectedstring
nil remove_all_items ( )

Removes all the items of the list.

string get_item ( integer  index)

Returns the label of the item at the given index, or an empty string.

Parameters
indexinteger
Returns
string
integer index_of ( string  label)

Returns the index of the first item with the given label, or -1.

Parameters
labelstring
Returns
integer
nil select ( integer  index)

Selects the item at the given index, -1 removes the selection.

Parameters
indexinteger
nil select ( string  label)

Selects the first item with the given label.

Parameters
labelstring
nil open ( )

Opens the popup list.

nil close ( )

Closes the popup list.

nil set_resources ( string  res_button,
string  res_arrow,
string  res_list)

Reloads the visual style: res_button = button, res_arrow = arrow, res_list = popup list.

Parameters
res_buttonstring
res_arrowstring
res_liststring

Property Documentation

integer count

The number of items in the list. (read-only)

string[] items

The labels of all the items, in display order. (read-only)

integer selected_index

Index of the selected item, or -1 if none is selected. (read-only)

string selected_item

Label of the selected item, or an empty string. (read-only)

string place_holder

Text displayed by the button when no item is selected.

boolean is_open

True while the popup list is displayed. (read-only)

integer max_displayed_items

Maximum number of items displayed at once by the popup list.

number arrow_width

Width of the arrow drawn at the right of the button.

Button button

The clickable button displaying the selected item. (read-only)

Text label

The text widget displaying the selected item. (read-only)

Arrow arrow

The arrow displaying the open state. (read-only)

string list_resource

Resource string used to style the popup list.