Files
Basalt/docs/objects/Checkbox.md
Robert Jelic 01412b4c55 docs
2022-07-17 22:37:32 +02:00

904 B

With checkbox objects the user can set a bool to true or false

Remember checkbox also inherits from Object

A checkbox does not have any custom methods. All required methods are provided by the base object class.

Example

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

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

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

Lua and XML:

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

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