Checkbox.checked read/write property

Set or check wether the Checkbox item is selected.


local ui = require "ui" -- create a simple window local win = ui.Window("Checkbox.y sample", 200, 100) local checkbox = ui.Checkbox(win, "Check Me !", 66, 30) -- Checkbox onClick event function checkbox:onClick() -- the checkbox will stay checked self.checked = true win:status("Your choice : "..(self.checked and "checked" or "unchecked")) end -- shows the window win:show() -- update status checkbox:onClick() -- update user interface repeat ui.update() until not win.visible