EventSourceHandle changed by timer?!

BlitzMax Forums/BlitzMax GUI Programming/EventSourceHandle changed by timer?!

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.

Using the timer appearantly makes the eventsource change and unreliable...

Try this piece of code and tell me if I'm nuts?!
Does anyone have an idea what happens here and how to resolve the problem?

Import MaxGUI.Drivers

SuperStrict

Global window:Tgadget = CreateWindow:TGadget("EventSource Test", Desktop().width*0.35, Desktop().height*0.35, 320, 240)', Null, WINDOW_CENTER | WINDOW_CLIENTCOORDS)
Global panel:Tgadget =CreatePanel(0,0,ClientWidth(window),ClientHeight(window),window,PANEL_ACTIVE|PANEL_GROUP,"click repeatedly here to see EventSourceHandle change!")
Global label:Tgadget = CreateLabel("EventSourceHandle() =",60,60,150,20,panel)
Global timer:Ttimer = CreateTimer(10)

Function MyHook:Object(iId:Int,tData:Object,tContext:Object)
	Local Event:TEvent = TEvent(TData)
	
	If event = Null Return Null
	
	Select Event.id
		Case EVENT_MOUSEDOWN
			SetGadgetText(label, "EventSourceHandle() = "+EventSourceHandle())
		Case EVENT_TIMERTICK
			If TimerTicks(timer)>10
				StopTimer(timer)
				timer = CreateTimer(10)
			EndIf
	EndSelect
	Return TData
End Function

AddHook EmitEventHook, MyHook

While True
	WaitEvent()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	EndSelect
Wend