Button.constructor(parent, caption, [ x ], [ y ], [ width ], [ height ]) constructor
The Button constructor returns a Button value representing a push button on the parent object.
Parameters
parent
An object that will own the Button. Parent objects can be any of Window, Groupbox, TabItem and Panel
caption
A string representing the Button's text.
x
An optional number that indicates the Button horizontal position, in pixels. Zero means the left border of the parent.
y
An optional number that indicates the Button vertical position, in pixels. Zero means the top border of the parent.
width
An optional number that indicates the Button width in pixels, autosized to fit text content if omitted.
height
An optional number that indicates the Button height in pixels, autosized to fit text content if omitted.
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Button.constructor() sample", 320, 200)
-- create a Button on this window, with "LuaRT" as text, at the x position 130, and y position 80
local button = ui.Button(win, "LuaRT", 130, 80)
win:show()
-- update the user interface until the user closes the Window
repeat
ui.update()
until not win.visible