TreeItem:clear() method


Remove all the TreeItem subitems.

Return value

This function returns no value.

Example

local ui = require "ui" local win = ui.Window("TreeItem:clear() sample", 320, 220) local tree = ui.Tree(win, {Item1 = {"SubItemC", "SubItemA", "SubItemB"}, "Item2", "Item3"}, 60, 40, 200, 160) local button = ui.Button(win, "Clear subitems", 120, 10) tree.items.Item1:expand() function button:onClick() tree.selected:clear() end win:show() while win.visible do ui.update() button.enabled = tree.selected ~= nil and tree.selected.count > 0 end