List:onHover(x, y, buttons)event
This event is fired when the user moves the mouse pointer over the List.
Parameters
x
The horizontal position of the mouse in the List area (zero means the left border of the widget).
y
The vertical position of the mouse in the List 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":trueif left mouse button is pressed,falseotherwise"right":trueif right mouse button is pressed,falseotherwise"middle":trueif middle mouse button is pressed,falseotherwise"control":trueif the CONTROL key is pressed,falseotherwise"shift":trueif the SHIFT mouse button is pressed,falseotherwise
Return value
The event returns no value.Example
--! luart-extensions
import ui
-- creates a simple window
local win = ui.Window("List:onHover() event sample", 320, 260)
local list = ui.List(win, {"ListItem 1", "ListItem 2", "ListItem 3"}, 120, 60)
-- List:onHover event
function list:onHover()
win:status("You are hovering the List Widget")
end
-- List:onLeave event
function list:onLeave()
win:status("The List Widget is no longer hovered")
end
win:status("")
await win:showasync()