Files
Basalt/docs/objects/Checkbox.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

1.1 KiB

The Checkbox object is derived from the VisualObject 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 and VisualObject 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.