Panel:onMouseDown(button, x, y) event


This event is fired when the user press a mouse button while beeing over the Panel.

Parameters

button

A string indicating the button that has been released : "right", "middle" or "left".

x

The horizontal position of the mouse in the Panel area (zero means the left border of the widget).

y

The vertical position of the mouse in the Panel area (zero means the top border of the widget).

Return value

The event returns no value.

Example

local ui = require "ui" -- create a fixed Window local win = ui.Window("Panel:onMouseDown() event sample", "fixed", 320, 200) -- create a Panel local panel = ui.Panel(win, 0, 0, 100, 100) panel.bgcolor = 0xF0A000 panel.cursor = "cross" panel:center() -- set a onMouseDown() and onMouseUp() events function panel:onMouseDown(btn, x, y) win:status(btn:upper().." mouse button is down at "..x..", "..y) end function panel:onMouseUp(btn, x, y) win:status(btn:upper().." mouse button is up at "..x..", "..y) end win:status("") ui.run(win):wait()