1. Mouse Wheel Events
I've recently been updating a program from onXXX to setHandler(). The program
used to catch
Mouse Wheel Events through the shift parameter of onMouse. Now with setHandler,
the Mouse Wheel
triggers a WM_MOUSEWHEEL message, but how do I determine whether it was up or
down? With
onMouse, the shift parameter would be #780000 for up and -#780000 for down. Now
what happens?
2. Re: Mouse Wheel Events
On Thu, 03 Apr 2003 00:18:38 -0500, Greg Haberek <g.haberek at comcast.net>
wrote:
>
> I've recently been updating a program from onXXX to setHandler(). The
> program used to catch
> Mouse Wheel Events through the shift parameter of onMouse. Now with
> setHandler, the Mouse Wheel
> triggers a WM_MOUSEWHEEL message, but how do I determine whether it was
> up or down? With
> onMouse, the shift parameter would be #780000 for up and -#780000 for
> down. Now what happens?
>
You're correct. I must update win32lib to provide this information. In the
meantime you can get it by doing this...
procedure onMouse_XXX(integer self, integer event, sequence parms)
sequence lRaw
atom lDist
lRaw = getLastMsg(0)
lDist = (hi_word(lRaw[4]) / 120)
if lDist < 0 then -- wheel down (towards user)
else
-- wheel up (away from user)
end if
end procedure
--
cheers,
Derek Parnell
3. Re: Mouse Wheel Events
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