Checkbox:onContext() event
This event is fired when the user has clicked on the Checkbox with the right mouse checkbox.
Return value
The event returns no value.Example
local ui = require "ui"
-- create a window
local win = ui.Window("Checkbox:onContext() sample", 320, 200)
local checkbox = ui.Checkbox(win, "Right-click on this Checkbox !", 80, 75)
-- set a onContext() event : display a dynamic popupmenu
function checkbox:onContext()
local popupmenu = ui.Menu()
popupmenu:add(self.checked and "Uncheck this item" or "Check this item").onClick = function ()
checkbox.checked = not checkbox.checked
end
self.parent:popup(popupmenu)
end
win:show()
while win.visible do
ui.update()
end