TreeItem.subitems read/write property
Provides access to the TreeItem subitems.
Reading this property returns a table that contains a list of TreeItem. This table can be indexed by item text. Using a wrong index or an invalid text will return a nil value.
Setting this property will change all the subitems in the TreeItem. It expects a table that contains a list of strings (each string will be a subitem in the TreeItem)
Example
local ui = require "ui"
local win = ui.Window("TreeItem.subitems sample", 320, 220)
local tree = ui.Tree(win, {"Item1", "Item2", "Item3"}, 60, 40, 200, 160)
local button = ui.Button(win, "Add subitems", 120, 10)
function button:onClick()
local item = tree.selected
item.subitems = { item.text..".SubItem1", item.text..".SubItem2" }
end
win:show()
repeat
ui.update()
button.enabled = tree.selected ~= nil
until not win.visible