Checkbox - sirinsidiator/ESO-LibAddonMenu GitHub Wiki
The Checkbox control offers a simple way to allow input of boolean setting values. It shows a label followed by an On/Off button.
property | type | default | required | description |
---|---|---|---|---|
type | string | - | yes | The widget type of this control ("checkbox") |
name | number, string, function | - | yes | The label for the checkbox |
getFunc | function | - | yes | The value provider for the checkbox. Needs to return a boolean value |
setFunc | function | - | yes | The assignment function for the checkbox. Needs to accept a boolean value |
default | boolean, function | nil | no | Default value of the checkbox which is used to reset the panel to its defaults |
warning | number, string, function | nil | no | Shows a warning icon beside the checkbox which has a tooltip with some warning text |
tooltip | number, string, function | nil | no | The tooltip to display for the checkbox |
requiresReload | boolean | false | no | Appends a special warning text and shows a reload button if the value is changed |
disabled | boolean, function | false | no | Determines if the checkbox is disabled and its value cannot be changed |
width | string | "full" | no | "full" or "half" width in the panel |
helpUrl | string, function | - | no | A string URL "https://www.esoui.com", or a function that returns one |
reference | string | nil | no | A unique global reference to the control |
This method updates the state of the checkbox with the value returned by getFunc if no arguments are passed. If forceDefaults is true, it will set the checkbox to the value in the default property. If forceDefaults is false and value is not nil, it will set the checkbox to the passed value
Only is exposed when the disabled property is not nil. This method updates the disabled state of the checkbox based on the resolved value of the disabled property.
Only is exposed when the warning property or the requiresReload property is set. This method updates the warning of the checkbox based on the resolved value of the warning and requiresReload property.
LAM:RegisterOptionControls(panelName, {
{
type = "checkbox",
name = "My Checkbox",
getFunc = function() return saveData.myBoolean end,
setFunc = function(value) saveData.myBoolean = value end,
default = defaultData.myBoolean,
reference = "MyAddonCheckbox"
}
})
local controls = {}
controls[#controls + 1] = {
type = "checkbox",
name = "My Other Checkbox",
getFunc = function() return saveData.myOtherBoolean end,
setFunc = function(value) saveData.myOtherBoolean = value end,
disabled = function() return not saveData.myBoolean end,
requiresReload = true,
width = "half"
}
LAM:RegisterOptionControls(panelName, controls)