This event is particularly interesting when you want to initialize its properties.
Tree:onCreate() event
This event is fired when the Tree object has just been created (just after the Tree:constructor() call).
Return value
The event returns no value.Example
local ui = require "ui"
-- creates a simple window
local win = ui.Window("Tree:onCreate() event sample", 320, 200)
local tree = ui.Tree(win, {"Item1", "Item2", Item3 = {"SubItem1", "SubItem2"}}, 100, 20, 150, 160)
-- Tree:onCreate event to set the font properties
function tree:onCreate()
tree.font = "Segoe UI"
tree.style = "icons"
tree.fontsize = "9"
end
win:show()
-- update Tree.text at each second
while win.visible do
ui.update()
end