List:onCreate() event


This event is fired when the List object has just been created (just after the List: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" -- creates a simple window local win = ui.Window("List:onCreate() event sample", 320, 200) local list = ui.List(win, {1, 10, 100, 1000}, 100, 20, 150, 160) -- List:onCreate event to set the font properties function list:onCreate() list.font = "Impact" list.fontsize = "24" list.fontstyle = { bold = true } end -- Spawn a Task to update list.text every second async(function() while true do sleep(1000) list.text = list.text + 1 end end) ui.run(win):wait()