Canvas:onPaint()event


This event is fired continuously to redraw the Canvas. You can put all your drawing operations inside this event handler function.

Return value

This event returns no value.

Example

--! luart-extensions import ui require "canvas" -- create a fixed Window local win = ui.Window("Canvas:onPait() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" -- set the onPaint() event handler to draw on the canvas function canvas:onPaint() self:begin() self:clear() self:print("Hello World !", 10, 10) self:flip() end -- shows the Window and wait for it to be closed await win:showasync()