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.

The below example shows that the changing handle is due to creating new timers
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,250,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
			
		Case EVENT_TIMERTICK
			SetGadgetText(label, "EventSourceHandle() = " + EventSourceHandle()+ " , " + MilliSecs() ) 
			Rem Uncomment this to se the old behaveiur
			If TimerTicks(timer)>10
				StopTimer(timer)
				timer = CreateTimer(10)
			EndIf
			End Rem
		EndSelect
	Return TData
End Function

AddHook EmitEventHook, MyHook

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