Files
Basalt/docs/docs1_6/objects/Checkbox.md
Robert Jelic d4c72514ef Docs 1.6
Accidentally uploaded outdated 1.6 docs
2023-05-01 16:28:46 +02:00

897 B

With checkboxes the user can set a boolean to true or false by clicking on them.

Object methods also apply for checkboxes.

setSymbol Changes the symbol when checkbox is checked

Example

This is how you would create a event which gets fired as soon as the value gets changed:

local main = basalt.createFrame()
local aCheckbox = main:addCheckbox()

local function checkboxChange(self)
   local checked = self:getValue()
   basalt.debug("The value got changed into ", checked)
end
aCheckbox:onChange(checkboxChange)

also possible via xml:

local main = basalt.createFrame():addLayout("example.xml")

basalt.setVariable("checkboxChange", function(self)
  local checked = self:getValue()
  basalt.debug("The value got changed into ", checked)
end)
<checkbox onChange="checkboxChange" />