Tree.items read/write property iterable


Provides access to the list of Tree items.

Reading this property returns a table that contains a list of TreeItem.
This table can be indexed by item text or by an integer index. Using a wrong index or an invalid text will return a nil value.
An integer index represents the item position in the Tree, starting from 1 (See TreeItem.index property).

Setting this property will change all the items in the List. It expects a table that contains a list of strings (each string will be an item in the Tree)

This property is iterable, with the each() or ipairs() function, returning TreeItem one by one at each iteration.

Example

local ui = require "ui" local win = ui.Window("Tree.items sample", "fixed", 320, 240) local button = ui.Button(win, "Iterate over Tree.items", 104, 10) local tree = ui.Tree(win, {}, 110, 40) tree.style ="icons" tree.items = { "Item 1", "Item 2", ["Item 3"] = { "Subitem1", "Subitem2" } } function button:onClick() for item in each(tree.items) do item:loadicon(sys.env.windir.."\\system32\\user32.dll", 6) end end -- show the Window win:show() while win.visible do ui.update() end