Panel.x read/write property


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

Example

local ui = require "ui" -- create a fixed Window local win = ui.Window("Panel.x sample", "fixed", 320, 200) -- create a Panel local panel = ui.Panel(win, 0, 0, 100, 100) panel.bgcolor = 0xF0A000 panel:center() panel.x = 0 async(function() while true do sleep() panel.x = panel.x + 2 if panel.x > win.width-panel.width then win:hide() end end end) ui.run(win):wait()