Tree:onMouseUp(button, x, y) event
This event is fired when the user releases a mouse button while beeing over the Tree.
Parameters
button
A string indicating the button that has been released : "right"
, "middle"
or "left"
.
x
The horizontal position of the mouse in the Tree area (zero means the left border of the widget).
y
The vertical position of the mouse in the Tree area (zero means the top border of the widget).
Return value
The event returns no value.Example
local ui = require "ui"
-- create a window
local win = ui.Window("Tree:onMouseUp() sample", 400, 300)
local label = ui.Label(win, "Move the mouse over the Tree, then press and release a mouse button!")
label.textalign = "center"
label.align = "top"
local tree = ui.Tree(win, {"Item1", "Item2"} )
tree:center()
-- set a onMouseUp() event : display a status bar with the released mouse button and its position
function tree:onMouseUp(b, x, y)
win:status("Mouse button : "..b, "Mouse position : "..x..", "..y)
end
ui.run(win):wait()