This event is particularly interesting when you want to initialize its properties.
Radiobutton:onCreate() event
This event is fired when the Radiobutton object has just been created (just after the Radiobutton:constructor() call).
Return value
The event returns no value.Example
local ui = require "ui"
-- create a custom widget from a Radiobutton
local LinkRadiobutton = Object(ui.Radiobutton)
function LinkRadiobutton:onCreate()
self.cursor = "hand"
end
-- sets the onHover event
function LinkRadiobutton:onHover()
self.fontstyle = { underline = true }
end
-- sets the onLeave event
function LinkRadiobutton:onLeave()
self.fontstyle = { underline = false }
end
-- create a window
local win = ui.Window("Radiobutton:onCreate() sample", 320, 200)
--create a LinkRadiobutton object
local radiobutton = LinkRadiobutton(win, "Click Me !", 120, 75)
function radiobutton:onClick()
win:status("LinkRadiobutton is "..(self.checked and "checked" or "unchecked"))
end
radiobutton:onClick()
win:show()
while win.visible do
ui.update()
end