TreeItem:expand(expanding)method


Expands or collapses the subitems associated with the TreeItem.

Parameters

expanding

An optional boolean value indicating if the item should expand (true) or collapse (false).
If omitted, the TreeItem will toggle and collapse if it is already expanded, or expand if it is collapsed.

Return value

This function returns no value.

Example

--! luart-extensions import ui local win = ui.Window("TreeItem:expand() sample", 320, 220) local tree = ui.Tree(win, {Item1 = {"SubItemA", "SubItemB", "SubItemC"}, "Item2", "Item3"}, 60, 40, 200, 160) local button = ui.Button(win, "Expand/Collapse subitems", 86, 10) function button:onClick() tree.selected:expand() end win:show() while win.visible do ui.update() button.enabled = tree.selected ~= nil and tree.selected.count > 0 end