Class mct_dropdown

MCT Dropdown Wrapped Type.

Functions

wrapped_type:new (option_obj) Create a new wrapped type within an mct_option.
wrapped_type:check_validity (val) Checks the validity of the value passed.
wrapped_type:set_default () Sets the default value for this dropdown, if none is selected by the modder.
wrapped_type:ui_select_value (val) Select a value within the UI; ie., change from the first dropdown value to the second.
wrapped_type:ui_change_state () Change the state of the mct_option in UI; ie., lock the option from being used.
wrapped_type:ui_create_option (dummy_parent) Create the dropdown option in UI.
wrapped_type:add_dropdown_values (dropdown_table) Method to set the dropdown_values.
wrapped_type:add_dropdown_value (key, text, tt, is_default) Used to create a single dropdown_value; also called within mct_option:add_dropdown_values
wrapped_type:refresh_dropdown_box () Only called on creation & adddropdownvalue, if the latter is called after the UI is created Allows for dynamic dropdowns!


Functions

Methods
wrapped_type:new (option_obj)
Create a new wrapped type within an mct_option.

Parameters:

  • option_obj mct_option The mctoption this wrappedtype is being passed.
wrapped_type:check_validity (val)
Checks the validity of the value passed.

Parameters:

  • val any Tested value.

Returns:

  1. boolean valid Returns true if the value passed is valid, false otherwise.
  2. boolean valid_return If the value passed isn't valid, a second return is sent, for a valid value to replace the tested one with.
wrapped_type:set_default ()
Sets the default value for this dropdown, if none is selected by the modder. Defaults to the first dropdown value added.
wrapped_type:ui_select_value (val)
Select a value within the UI; ie., change from the first dropdown value to the second.

Parameters:

  • val
wrapped_type:ui_change_state ()
Change the state of the mct_option in UI; ie., lock the option from being used.
wrapped_type:ui_create_option (dummy_parent)
Create the dropdown option in UI.

Parameters:

  • dummy_parent local templates = option_obj getuictemplate()
wrapped_type:add_dropdown_values (dropdown_table)

Method to set the dropdown_values. This function takes a table of tables, where the inner tables have the fields ["key"], ["text"], ["tt"], and ["is_default"]. The latter three are optional. ex:

  mct_option:add_dropdown_values({
      {key = "example1", text = "Example Dropdown Value", tt = "My dropdown value does this!", is_default = true},
      {key = "example2", text = "Lame Dropdown Value", tt = "This dropdown value does another thing!", is_default = false},
  })

Parameters:

  • dropdown_table [[if not self get_type() == "dropdown" then
wrapped_type:add_dropdown_value (key, text, tt, is_default)
Used to create a single dropdown_value; also called within mct_option:add_dropdown_values

Parameters:

  • key string The unique identifier for this dropdown value.
  • text string The localised text for this dropdown value.
  • tt string The localised tooltip for this dropdown value.
  • is_default boolean Whether or not to set this dropdown_value as the default one, when the dropdown box is created.
wrapped_type:refresh_dropdown_box ()
Only called on creation & adddropdownvalue, if the latter is called after the UI is created Allows for dynamic dropdowns!
generated by LDoc 1.4.6 Last updated 2021-01-03 11:23:43