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