The Canvas.visible property is also affected by the Canvas:show() and Canvas:hide() methods.
Canvas.visible read/write property
Get or set the Canvas visibility on screen, a true value means that the Canvas is shown, a false value means that the Canvas is hidden.
Example
local ui = require "ui"
require "canvas"
-- create a simple Canvas
local win = ui.Window("Canvas.visible sample", 640, 480)
local Canvas = ui.Canvas(win, 0, 50, 640, 430)
Canvas.fontsize = 28
Canvas:hide()
local button = ui.Button(win, "Show the Canvas widget")
button:center()
button.y = 10
win:show()
function Canvas:onPaint()
self:clear()
self:print("Hello, it's me !", 250, 190, math.random(0, 0xFFFFFFFF))
end
function button:onClick()
Canvas.visible = true
end
while win.visible do
ui.update()
end