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
This commit is contained in:
@@ -1,36 +1,34 @@
|
||||
With checkboxes the user can set a boolean to true or false by clicking on them.
|
||||
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.
|
||||
|
||||
[Object](objects/Object.md) methods also apply for checkboxes.
|
||||
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
|
||||
This is how you would create a event which gets fired as soon as the value gets changed:
|
||||
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)
|
||||
local checked = self:getValue()
|
||||
basalt.debug("The value got changed into ", checked)
|
||||
end
|
||||
aCheckbox:onChange(checkboxChange)
|
||||
```
|
||||
|
||||
also possible via xml:
|
||||
```lua
|
||||
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)
|
||||
```
|
||||
|
||||
```xml
|
||||
<checkbox onChange="checkboxChange" />
|
||||
<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.
|
||||
|
||||
Reference in New Issue
Block a user