Canvas:onCreate() event


This event is fired when the Canvas object has just been created (just after the Canvas:constructor() call).

This event is particularly interesting when you want to initialize its properties.

Return value

The event returns no value.

Example

local ui = require "ui" require "canvas" -- creates a simple window local win = ui.Window("Canvas:onCreate() event sample", 640, 400) local Canvas = ui.Canvas(win, 320, 200) -- Canvas:onCreate() event to center and draw text on the Canvas widget function Canvas:onCreate() self:begin() self:center() self:clear(0x000000FF) self:print("Hello LuaRT !", 130, 100, 0xFFA300FF) self:flip() end ui.run(win):wait()