Module expcore.gui.checkboxs
Gui class define for checkboxs and radiobuttons [[
Functions
Checkbox.new_checkbox ([name]) | Creates a new checkbox element define |
Checkbox.new_radiobutton ([name]) | Creates a new radiobutton element define, has all functions checkbox has |
Checkbox._prototype_radiobutton:add_as_option (option_set, option_name) | Adds this radiobutton to be an option in the given option set (only one can be true at a time) |
Checkbox._prototype_radiobutton:get_store (category, internal) | Gets the stored value of the radiobutton or the option set if present |
Checkbox._prototype_radiobutton:set_store (category, value, internal) | Sets the stored value of the radiobutton or the option set if present |
Checkbox.new_option_set (name, callback, categorize) | Registers a new option set that can be linked to radiobutotns (only one can be true at a time) |
Checkbox.draw_option_set (name, element) | Draws all radiobuttons that are part of an option set at once (Gui.draw will not work) |
Checkbox.reset_radiobuttons (element[, exclude[, recursive=false]]) | Sets all radiobutotn in a element to false (unless excluded) and can act recursivly |
Functions
- Checkbox.new_checkbox ([name])
-
Creates a new checkbox element define
Parameters:
- name string the optional debug name that can be added (optional)
Returns:
-
table
the new checkbox element define
- Checkbox.new_radiobutton ([name])
-
Creates a new radiobutton element define, has all functions checkbox has
Parameters:
- name string the optional debug name that can be added (optional)
Returns:
-
table
the new button element define
- Checkbox._prototype_radiobutton:add_as_option (option_set, option_name)
-
Adds this radiobutton to be an option in the given option set (only one can be true at a time)
Parameters:
- option_set string the name of the option set to add this element to
- option_name string the name of this option that will be used to idenitife it
Returns:
-
self
the define to allow chaining
- Checkbox._prototype_radiobutton:get_store (category, internal)
-
Gets the stored value of the radiobutton or the option set if present
Parameters:
- category string [opt] the category to get such as player name or force name
- internal boolean used to prevent stackover flow
Returns:
-
any
the value that is stored for this define
- Checkbox._prototype_radiobutton:set_store (category, value, internal)
-
Sets the stored value of the radiobutton or the option set if present
Parameters:
- category string [opt] the category to get such as player name or force name
- value boolean the value to set for this define, must be valid for its type ie for checkbox etc
- internal boolean used to prevent stackover flow
Returns:
-
boolean
true if the value was set
- Checkbox.new_option_set (name, callback, categorize)
-
Registers a new option set that can be linked to radiobutotns (only one can be true at a time)
Parameters:
- name string the name of the option set, must be unique
- callback function the update callback when the value of the option set chagnes callback param - value string - the new selected option for this option set callback param - category string - the category that updated if categorize was used
- categorize function the function used to convert an element into a string
Returns:
-
string
the name of this option set to be passed to add_as_option
- Checkbox.draw_option_set (name, element)
-
Draws all radiobuttons that are part of an option set at once (Gui.draw will not work)
Parameters:
- name string the name of the option set to draw the radiobuttons of
- element LuaGuiElement the parent element that the radiobuttons will be drawn to
- Checkbox.reset_radiobuttons (element[, exclude[, recursive=false]])
-
Sets all radiobutotn in a element to false (unless excluded) and can act recursivly
Parameters:
- element LuaGuiElement the root gui element to start setting radio buttons from
- exclude table ?string|table the name of the radiobutton to exclude or a of radiobuttons where true will set the state true (optional)
- recursive number or boolean if true will recur as much as possible, if a will recur that number of times (default false)
Returns:
-
boolean
true if successful