Tree.fontstyle read/write property
Get or set the Tree font style, a table value that contains the following keys/values :
- "italic" : set to true if the font is in italic.
- "underline" : set to true if the font is underlined.
- "strike" : set to true if the font is
striked. - "thin" : set to true if the font is thin.
- "bold" : set to true if the font is bold.
- "heavy" : set to true if the font is heavy.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Tree.fontstyle sample", 320, 240)
ui.Label(win, "Font size :", 100, 10)
local tree = ui.Tree(win, {"Item 1", "Item 2", "Item 3"}, 106, 40)
-- create a font style tree
local cb = ui.Combobox(win, { tree.fontsize, tree.fontsize+2, tree.fontsize+4, tree.fontsize+6, tree.fontsize+8 }, 150, 6, 80)
cb.selected = cb.items[1]
-- change tree.fontstyle upon selection
function cb:onSelect(item)
tree.fontstyle = { [item.text] = true }
win:status("Tree fontstyle : "..item.text)
end
win:show()
-- update the user interface until the user closes the Window
repeat
ui.update()
until not win.visible