Canvas:show() method
Show and activate the Canvas (events can now be fired).
Return value
This function returns no value.Example
local ui = require "ui"
require "canvas"
-- create a simple Window
local win = ui.Window("Canvas:onShow() sample", 640, 480)
-- create a canvas and center it
local canvas = ui.Canvas(win, 0, 0, 600, 400)
canvas.align = "all"
canvas.visible = false
-- set the onShow() event handler to draw on the canvas
function canvas:onShow()
self:begin()
-- clears the canvas backbuffer with white color
self:clear(0xFFFFFFFF)
-- prints text
self:print("Canvas is now visible !", 10, 10)
-- shows the backbuffer
self:flip()
end
-- Launch a Task to show the Canvas in 2sec
async(function()
sleep(2000)
canvas:show()
end)
ui.run(win):wait()