TabItems are ephemeral objects that are instantiated by their owner objects, with the List.items property. It is not recommended to use a TabItem that have been previously removed.
TabItem:remove() method
Removes the TabItem from the List it belongs to.
Return value
This method returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("TabItem:remove() sample", 316, 246)
local tab = ui.Tab(win, {"autoexec.bat", "config.sys"}, 10, 10)
function win.CtrlW()
if tab.count > 0 then
tab.selected:remove()
end
end
win:shortcut("w", win.CtrlW, true)
win:status("Press CTRL+W to remove a TabItem")
-- shows the Window
win:show()
-- update user interface
repeat
ui.update()
until not win.visible