Button.textalign read/write property
Get or set the Button text alignment, a string value that represent how the text will be displayed.
- "left" : the text is aligned to the left edge of the Button.
- "right" : the text is aligned to the right edge of the Button.
- "center" : the text is aligned in the center of the Button area (the default).
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Button.textalign sample", 320, 200)
local button = ui.Button(win, "LuaRT", 0, 0, 100)
button:center()
-- create a combobox
local cb = ui.Combobox(win, { "left", "center", "right" }, 100, 30)
cb:center()
cb.y = cb.y + 32
cb.selected = cb.items[button.textalign]
-- change label.textalign property upon selection
function cb:onSelect(item)
button.textalign = item.text
end
-- update the user interface until the user closes the Window
ui.run(win):wait()