This event is particularly interesting when you want to initialize its properties.
Combobox:onCreate() event
This event is fired when the Combobox object has just been created (just after the Combobox:constructor() call).
Return value
The event returns no value.Example
local ui = require "ui"
-- creates a simple window
local win = ui.Window("Combobox:onCreate() event sample", 320, 200)
local combobox = ui.Combobox(win, {1, 10, 100, 1000}, 120, 70)
-- Combobox:onCreate event to set the font properties
function combobox:onCreate()
combobox.text = "0"
combobox.font = "Impact"
combobox.fontsize = "24"
combobox.fontstyle = { bold = true }
end
-- Spawn a Task to update Combobox.text every second
async(function()
while true do
sleep(1000)
combobox.text = combobox.text + 1
end
end)
ui.run(win):wait()