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