Label:onHover(x, y, buttons) event
This event is fired when the user moves the mouse pointer over the Label.
Parameters
x
The horizontal position of the mouse in the Label area (zero means the left border of the widget).
y
The vertical position of the mouse in the Label area (zero means the top border of the widget).
buttons
A table
which fields indicates if mouse buttons or special keys have been pressed during the move :
"left"
:true
if left mouse button is pressed,false
otherwise"right"
:true
if right mouse button is pressed,false
otherwise"middle"
:true
if middle mouse button is pressed,false
otherwise"control"
:true
if the CONTROL key is pressed,false
otherwise"shift"
:true
if the SHIFT mouse button is pressed,false
otherwise
Return value
The event returns no value.Example
local ui = require "ui"
-- create a window
local win = ui.Window("Window:onHover() sample", 320, 200)
local label = ui.Label(win, "Move the mouse over this text!", 110, 75)
-- set a onClick() event : display a status bar with the mouse position when the user hovers the label
function label:onHover(x, y, buttons)
win:status("Mouse is inside Label at "..x..", "..y, buttons.left and "LEFT button" or "", buttons.right and "RIGHT button" or "", buttons.middle and "MIDDLE button" or "")
end
ui.run(win):wait()