Entry.textalign read/write property
Get or set the Entry text alignment, a string value that represent how the text will be displayed.
- "left" : the text is aligned to the left edge of the Entry (the default).
- "right" : the text is aligned to the right edge of the Entry.
- "center" : the text is aligned in the center of the Entry area.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Button.textalign sample", 320, 200)
local entry = ui.Entry(win, "LuaRT", 0, 0, 100)
entry: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[entry.textalign]
-- change label.textalign property upon selection
function cb:onSelect(item)
entry.textalign = item.text
end
-- update the user interface until the user closes the Window
ui.run(win):wait()