TreeItem.previous readonly property


Retrieves the previous sibling item before the TreeItem

This property returns the previous sibling TreeItem or nil if there is none.

Example

local ui = require "ui" -- create a fixed Window local win = ui.Window("TreeItem.previous sample", 320, 220) local tree = ui.Tree(win, {"TreeItem1", "TreeItem2", "TreeItem3"}, 60, 40, 200, 160) tree.selected = tree.items["TreeItem1"] tree.selected.subitems = {"SubItem1", "SubItem2"} ui.Button(win, "Next", 76, 10).onClick = function (self) local next = tree.selected.next if next then tree.selected = next end end ui.Button(win, "Previous", 156, 10).onClick = function (self) local prev = tree.selected.previous if prev then tree.selected = prev end end ui.run(win):wait()