Tree.width read/write property
Get or set the Tree width. The width starts from 0 (left side of the Tree) and increases to the right direction.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Tree.width sample", 320, 230)
local tree = ui.Tree(win, {"Item 1", "Item 2"}, 100, 10)
local inc_btn = ui.Button(win, "Increase Tree.width", 40, 200)
local dec_btn = ui.Button(win, "Decrease Tree.width", inc_btn.x+inc_btn.width+6, inc_btn.y)
inc_btn.delta = 10
dec_btn.delta = -10
local function onClick(self)
tree.width = tree.width + self.delta
end
inc_btn.onClick = onClick
dec_btn.onClick = onClick
-- shows the Window
win:show()
-- update user interface
repeat
ui.update()
until not win.visible