TreeItem:remove() method

Removes the TreeItem from the Tree it belongs to.

TreeItems are ephemeral objects that are instantiated by their owner objects, with the Tree.items property. It is not recommended to use a TreeItem that have been previously removed.

Return value

This method returns no value.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("TreeItem:remove() sample", 316, 246) local tree = ui.Tree(win, {"autoexec.bat", "config.sys"}, 10, 10) function win.CtrlW() if tree.count > 0 then tree.selected:remove() end end win:shortcut("w", win.CtrlW, true) win:status("Press CTRL+W to remove a TreeItem") -- shows the Window win:show() -- update user interface repeat ui.update() until not win.visible