This event is particularly interesting when you want to initialize its properties.
Progressbar:onCreate() event
This event is fired when the Progressbar object has just been created (just after the Progressbar:constructor() call).
Return value
The event returns no value.Example
local ui = require "ui"
-- creates a simple window
local win = ui.Window("Progressbar:onCreate() event sample", 320, 200)
local pb = ui.Progressbar(win)
pb.themed = false
pb:center()
-- Progressbar:onCreate event to set properties
function pb:onCreate()
self.fgcolor = 0xFF0000
end
-- Advance Progressbar.position each second
async(function()
while pb.position < 100 do
sleep(1000)
pb:advance(10)
end
end)
ui.run(win):wait()