Skip to content

Checkbox

Robert Jelic edited this page Apr 2, 2022 · 7 revisions

Checkbox are objects, which sets the value to true or false by clicking on them

Here is a example of how to create a standard checkbox:

local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):show()

This will create a default button with the size 1 width and 1 height on position 1 1 (relative to its parent frame), the default background is colors.lightBlue, the default text color is colors.black and the default zIndex is 5. The default value is false

Here are all possible functions available for checkbox. Remember checkbox inherit from object:

There are currently no unique functions. Everything you need you can see in the object page.

Examples

Get and set the current value:

local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
NyoUI.debug(aCheckbox:getValue()) - returns true

Create a onChange event:

local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) NyoUI.debug("The value got changed into "..self:getValue()) end):show()

Wiki Navigation

Home
Clone this wiki locally