The master branch was reverted to 1.7 because it was very unstable (bugs and stuff that wasn't mentioned on the documentation page yet) - features will come back with 2.0 - fixed debug window - fixed flexbox not sending drag events to it's children - small docs updates for 1.7 - removed the examples because the are outdated
1.1 KiB
1.1 KiB
The Checkbox object is derived from the ChangeableObject class and allows users to set a boolean value to true or false by clicking on it. Checkboxes are commonly used in forms and settings to enable or disable specific options.
In addition to the Object, VisualObject and ChangeableObject methods, checkboxes also have the following method:
| setSymbol | Changes the symbol when checkbox is checked |
Example
Here's an example of how to create a Checkbox object and attach an event that gets fired when the value changes:
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:
<checkbox onChange="checkboxChange">
<onChange>
local checked = self:getValue()
basalt.debug("The value got changed into ", checked)
</onChange>
</checkbox>
In these examples, a checkbox is created, and when the value changes, a debug message prints the new value of the checkbox.