The checkbox.visible property is also affected by the Checkbox:show() and Checkbox:hide() methods.
Checkbox.visible read/write property
Get or set the checkbox visibility on screen, a true value means that the Checkbox is shown, a false value means that the Checkbox is hidden.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Checkbox.visible sample", 320, 200)
local checkbox = ui.Checkbox(win, "Click Me (if you can !)", 100, 80)
-- Hides the checkbox when hovering it
function checkbox:onHover()
self.visible = false
end
-- Shows the checkbox when hovering the checkbox area
function win:onHover(x,y buttons)
checkbox.visible = (x < checkbox.x or x > checkbox.x + checkbox.width) or (y < checkbox.y or y > checkbox.y + checkbox.height)
end
-- Impossible !
function checkbox:onClick()
ui.msg("Great job !!")
end
ui.run(win):wait()