List.x read/write property


Get or set the List horizontal position. The horizontal position start from 0 (left side of the parent widget) and increase to the right (right side of the parent widget).

Example

local ui = require "ui" -- create a simple window local win = ui.Window("List.x sample", 600, 300) local button = ui.Button(win, "Change Tree position", 240) local tree = ui.List(win, {'Item 1', 'Item 2'}, 10, 140) function button:onClick() tree.x = math.random(10, win.width-tree.width) tree.y = math.random(40, win.height-tree.height) end -- shows the window win:show() -- update user interface and increase Tree horizontal position repeat ui.update() until not win.visible