| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Message
| OK, I added the delta to the high-order 16 bits of the flags (for minimum compatibility disruption) however in my testing the delta amount was always 120.
The delta is unsigned, so you still have to test the flag. Example code:
win = "test_" .. GetPluginID () -- get a unique name, ensure not empty if outside plugin
WindowCreate (win, 0, 0, 200, 200, miniwin.pos_center_all, 0, ColourNameToRGB("white")) -- create window
WindowShow (win, true) -- show it
WindowAddHotspot(win, "hs1",
10, 10, 100, 100, -- rectangle
"", -- mouseover
"", -- cancelmouseover
"", -- mousedown
"", -- cancelmousedown
"", -- mouseup
"Tooltip message", -- tooltip text
miniwin.cursor_hand, 0) -- hand cursor
function mousewheelhandler (flags, hotspotid)
local delta = bit.shr (flags, 16)
if bit.band (flags, miniwin.wheel_scroll_back) ~= 0 then
print (delta, "backwards")
else
print (delta, "forwards")
end -- if
end -- mousewheelhandler
WindowRectOp (win, miniwin.rect_frame, 10, 10, 100, 100, ColourNameToRGB("blue"))
WindowScrollwheelHandler(win, "hs1", "mousewheelhandler")
https://github.com/nickgammon/mushclient/commit/d2f7129 |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|