Tab:onContext(tabitem) event
This event is fired when a right-click occured on the specified TabItem.
If tabitem argument is nil, then the right-click occured on the Tab page.
Return value
This event returns no value.Example
local ui = require "ui"
-- creates a simple window
local win = ui.Window("Tab:onContext() event sample", 320, 260)
local tab = ui.Tab(win, {"TabItem 1", "TabItem 2", "TabItem 3"})
-- Tab:onContext event
function tab:onContext(item)
-- show popup menu if onContext event occured on Tabs
if item ~= nil then
local menu = ui.Menu("Close TabItem")
menu.items[1].onClick = function (self)
tab:remove(item)
end
win:popup(menu)
end
end
win:show()
-- update window
while win.visible do
ui.update()
end