Module expcore.gui.dropdown
Gui class define for dropdowns and list boxs [[
Functions
Dropdown.new_dropdown ([name]) | Creates a new dropdown element define |
Dropdown.new_list_box ([name]) | Creates a new list box element define |
Dropdown._prototype:new_static_options (options[, ...], the) | Adds new static options to the dropdown which will trigger the general callback |
Dropdown._prototype:new_dynamic_options (callback) | Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options) |
Dropdown._prototype:add_option_callback (option, callback) | Adds a case specific callback which will only run when that option is selected (general case still triggered) |
Dropdown.select_value (element, value) | Selects the option from a dropdown or list box given the value rather than key |
Dropdown.get_selected_value (element) | Returns the currently selected value rather than index |
Functions
- Dropdown.new_dropdown ([name])
-
Creates a new dropdown element define
Parameters:
- name string the optional debug name that can be added (optional)
Returns:
-
table
the new dropdown element define
- Dropdown.new_list_box ([name])
-
Creates a new list box element define
Parameters:
- name string the optional debug name that can be added (optional)
Returns:
-
table
the new list box element define
- Dropdown._prototype:new_static_options (options[, ...], the)
-
Adds new static options to the dropdown which will trigger the general callback
Parameters:
- Dropdown._prototype:new_dynamic_options (callback)
-
Adds a callback which should return a table of values to be added as options for the dropdown (appended after static options)
Parameters:
- callback function the function that will run to get the options for the dropdown callback param - player LuaPlayer - the player that the element is being drawn to callback param - element LuaGuiElement - the element that is being drawn callback return - table - the values of this table will be appended to the static options of the dropdown
Returns:
-
self
the define to allow chaining
- Dropdown._prototype:add_option_callback (option, callback)
-
Adds a case specific callback which will only run when that option is selected (general case still triggered)
Parameters:
- option string the name of the option to trigger the callback on; if not already added then will be added as an option
- callback function the function that will be called when that option is selected callback param - player LuaPlayer - the player who owns the gui element callback param - element LuaGuiElement - the element which is being effected callback param - value string - the new option that has been selected
Returns:
-
self
the define to allow chaining
- Dropdown.select_value (element, value)
-
Selects the option from a dropdown or list box given the value rather than key
Parameters:
- element LuaGuiElement the element that contains the option
- value string the option to select from the dropdown
Returns:
-
number
the key where the value was
- Dropdown.get_selected_value (element)
-
Returns the currently selected value rather than index
Parameters:
- element LuaGuiElement the gui element that you want to get the value of
Returns:
-
string
the value that is currently selected