EVENT_MOUSEMOVE / EventX() conflict with keyboard?

BlitzMax Forums/BlitzMax GUI Programming/EVENT_MOUSEMOVE / EventX() conflict with keyboard?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi, I'm having some trouble with the MOUSE_MOVE event, as it seems to be thrown even by the keyboard somewhat.
Furthermore, it appears as when this event is thrown by the keyboard, EventX() and Event.X are not equal. Confusing!

Here's a little code that demonstrate. Run this, and then, while moving the mouse, press a key. Here I get the debug message:

DebugLog:Bug: Mouse Move event thrown by keyboard? event.X=404 eventx()=0
DebugLog:Bug: Mouse Move event thrown by keyboard? event.X=284 eventx()=0
DebugLog:Bug: Mouse Move event thrown by keyboard? event.X=286 eventx()=0
....



If fact, the event is not exactly thrown by the keypress: it's more like it's being registered and will get fired as soon as the mouse moves again. Code was tested only on Win32 XP.

Strict

Global MainWindow:TGadget = CreateWindow:TGadget("" , 40 , 40 , 500 , 300 , Null , WINDOW_TITLEBAR ) 

Global panel:TGadget = CreatePanel(0, 0, ClientWidth(MainWindow), ClientHeight(MainWindow), MainWindow, PANEL_ACTIVE | PANEL_BORDER)
ActivateGadget(panel)

AddHook EmitEventHook, MyHook

Repeat
	WaitEvent() 
	
	Local source:Object = EventSource() 
	Local data:Int = EventData()
	If EventID() = EVENT_WINDOWCLOSE Then End
Forever

Function MyHook:Object(iId:Int,tData:Object,tContext:Object)
	Local Event:TEvent=TEvent(tData)
	
	If Event.ID = EVENT_MOUSEMOVE
		' EventX() will be 0 when detecting a 'bad mouse move event'
		If EventX() = 0 Then
			Local tmp$ = "Bug: Mouse Move event thrown by keyboard? event.X=" + Event.X + " eventx()="+EventX()
			DebugLog tmp$
			SetGadgetText(MainWindow, tmp$)
		End If
	EndIf
	
	Return tData
End Function