Button.x read/write property


Get or set the Button 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("Button.x sample", 600, 300) local button = ui.Button(win, "Click me !", 10, 140) -- set an button.onClick event handler function button:onClick() self.x = math.random(500) self.y = math.random(260) end -- shows the window win:show() -- update user interface and increase Button horizontal position repeat ui.update() until not win.visible