Button:onClick() event


This event is fired when the user has clicked on the Button.

Return value

The event returns no value.

Example

local ui = require "ui" -- create a window local win = ui.Window("Button:onClick() sample", 320, 200) local button = ui.Button(win, "Click me !", 100, 75) -- set a onClick() event : change the button position function button:onClick() button.x = math.random(win.width-self.width) button.y = math.random(win.height-self.height) end win:show() while win.visible do ui.update() end