onMouseWheel (Callback)


onMouseWheel (hWnd, delta, x, y)

This callback is invoked when the mouse wheel is rotated.

Parameter Description
hWnd The handle to the window which had input focus when the mouse wheel was rotated.
delta The distance and direction the wheel was rotated, see remarks for more information
x The x coordinate where the wheel was rotated. Relative to the upper left hand corner of the window
y The y coordinate where the wheel was rotated. Relative to the upper left hand corner of the window

Returns

0

Remarks

This is a callback function. You must supply this function yourself. Register this callback with the WinXRegOnMouseWheel function.

If the delta parameter is positive, the mouse was rotated up, if it is negative, the mouse was rotated down. delta is always a multiple or division of 120. The scrolling of a single line is supposed to occur only when delta has reached 120. If delta is smaller than 120, you should add it to a static variable and not scroll untill that variable reaches 120. Alternatively you could scroll partial lines. If it is larger than 120 you should scroll several lines.

Examples

FUNCTION onMouseWheel (hWnd, delta, x, y)

'which direction did the user scroll?
IF delta < 0 THEN direction$ = "down" ELSE direction$ = "up"

'assuming we have a console attached to this app,
'tell the user how many lines we scrolled
PRINT "You scrolled ";direction$;" ";delta/120;" lines"

END FUNCTION

Related Links

WinXRegOnMouseWheel