Tab:onContext(TabItem)event


This event is fired when a right-click occured on the specified TabItem or on the current Tab page

Parameters

TabItem

The right clicked TabItem or nil if the right click occured on the Tab page

Return value

This event returns no value.

Example

--! luart-extensions import 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