Re: Mouse Wheel Events
- Posted by Derek Parnell <ddparnell at bigpond.com> Apr 03, 2003
- 324 views
On Thu, 03 Apr 2003 16:32:38 +1000, Derek Parnell <ddparnell at bigpond.com> wrote: [snip] > > You're correct. I must update win32lib to provide this information. In > the meantime you can get it by doing this... > My example was 'off-the-cuff'. Here is a real working example... ------------- without warning include win32lib.ew constant MyWin = create(Window, "Mouse Wheel", 0, 0, 0, 400, 400, 0) constant SB = create(StatusBar, "", MyWin, 0, 0, 0, 0, 0) constant BK = create(LText, "XXX", MyWin, 196, 200, 32, 25, 0) procedure onMouse_XXX(integer self, integer event, sequence parms) sequence lRaw atom lDist sequence lMsg sequence lPosn if parms[1] != WM_MOUSEWHEEL then return end if lRaw = getLastMsg(0) lDist = hi_word(lRaw[1][4]) if lDist > #7FFF then lDist -= #10000 end if lDist /= 120 if lDist < 0 then -- wheel down (towards user) lMsg = "To User" else -- wheel up (away from user) lMsg = "Away from User" end if lPosn = getRect(BK) if parms[4] = 0 then -- Vertical movement lPosn[2] += 5*lDist else -- Shiftkey pressed so horizontal mvt lPosn[1] += 5*lDist end if setRect(BK, lPosn[1], lPosn[2], 32, 25, 1) setText(SB, {"%s\t\t%d %d", {lMsg, lPosn[1], lPosn[2]}}) repaintWindow(MyWin) end procedure setHandler(MyWin, w32HMouse, routine_id("onMouse_XXX")) WinMain(MyWin, Normal) -- cheers, Derek Parnell