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