polled input sticking

BlitzMax Forums/BlitzMax Bug Reports/polled input sticking

Problem is not just with polled input. Here is another example but this time using EVENT_KEYDOWN and EVENT_KEYUP hold a key down and watch the KEYUP event being generated?

Const WINDOW_WIDTH=640
Const WINDOW_HEIGHT=384

Global hit[1024]

Function MyKeyDown( key:Int )
	Return HIT[Key]
End Function

Local wx=(GadgetWidth(Desktop())-WINDOW_WIDTH)/2
Local wy=(GadgetHeight(Desktop())-WINDOW_HEIGHT)/2
Global main_window:TGadget = CreateWindow( Title$,wx,wy,WINDOW_WIDTH,WINDOW_HEIGHT,Null,WINDOW_TITLEBAR | WINDOW_CLIENTCOORDS)
Global canvas:TGadget=CreateCanvas(0,0,WINDOW_WIDTH,WINDOW_HEIGHT,main_window)
SetGraphics CanvasGraphics(canvas)

ActivateGadget canvas

CreateTimer(10)

'enablepolledinput()

While WaitEvent()

	Select	EventID()

		Case EVENT_WINDOWCLOSE
			End

		Case EVENT_KEYUP
			DebugLog "KEY UP"
			Select EventData()
				Case KEY_LEFT
					HIT[KEY_LEFT]=0
			End Select
			
		Case EVENT_KEYDOWN
			DebugLog "KEY DOWN"
			Select EventData()
				Case KEY_LEFT
					HIT[KEY_LEFT]=1
			End Select

		Case EVENT_TIMERTICK

			If MyKeyDown(KEY_LEFT)
				SetClsColor Rnd(255),Rnd(255),Rnd(255)
				Cls
				Flip
			EndIf

	EndSelect

End While