EVENT_MOUSEWHEEL - weird values

BlitzMax Forums/MaxGUI Module/EVENT_MOUSEWHEEL - weird values

maverick69(Posted 2008) [#1]
I want to geht the mouse coords when using the mousewheel over a canvas gadget, but the x and y field of the mousewheel event object are returning weird values.

What do they return? How can I get the real mouse coords relative to the left top corner of the canvas (or window)?

Strict 

Local window:TGadget

window = CreateWindow("My Window", 40, 40, 320, 240) 
Local c:TGadget = CreateCanvas(10,10,50,50,window)

While True
	WaitEvent 
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_MOUSEWHEEL
			DebugLog CurrentEvent.x + "/" + CurrentEvent.y
		Case EVENT_GADGETPAINT
			SetGraphics CanvasGraphics(c) 
			cls
	End Select
Wend



grable(Posted 2008) [#2]
It returns the X,Y position relative to the canvas.
just verify that the position is within it before proceeding.

I believe it is this way so that one can scroll over any part of the ui without having to click it first. (although one does have to click the canvas before any events get fired)


maverick69(Posted 2008) [#3]
Hmm.... in my app they WM_MOUSEWHEEL x/y eventdata are providing other values than for example WM_MOUSEMOVE. Its not X/Y position relative to the canvas.


grable(Posted 2008) [#4]
Thats odd, what OS are you running on?
Im on Windows XP and using MaxGUI.Win32MaxGUIEx.

If the mouse is within the canvas, i get the correct position.
But outside the canvas, or even outside the window i get negative values when on the left/upper side and positive values otherwise.


maverick69(Posted 2008) [#5]
WindowsXP over here...

I get negative values even inside the canvas. Weired - if I move the window (the group of the canvas) the coords are chaninging???