Label.textalign
Get or set the Label text alignment, a string value that represent how the text will be displayed.
- "left" : the text is aligned to the left edge of the Label (the default).
- "right" : the text is aligned to the right edge of the Label.
- "center" : the text is aligned in the center of the Label area.
Example
--! luart-extensions
import ui
-- create a simple Window
local win = ui.Window("Label.textalign sample", 320, 200)
local label = ui.Label(win, "LuaRT")
label:center()
-- create a combobox
local cb = ui.Combobox(win, { "left", "center", "right" }, 100, label.y + 32)
cb.selected = cb.items[1]
-- change label.textalign property upon selection
function cb:onSelect(item)
label.textalign = item.text
end
win:show()
-- update the user interface until the user closes the Window
await win:showasync()