- 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
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
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](objects/Checkbox/setSymbol.md)|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:
|
|
|
|
```lua
|
|
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:
|
|
|
|
```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.
|