polled input on a MaxGUI canvas?

BlitzMax Forums/BlitzMax Beginners Area/polled input on a MaxGUI canvas?

EnablePolledInput()? Probably the easiest way.

Crude example:
SuperStrict

Framework brl.glmax2d
Import brl.polledinput

?win32
Import brl.win32maxgui	
?macos
Import brl.cocoamaxgui
?linux
Import brl.fltkmaxgui
?

Local hWin:TGadget = CreateWindow("Polled Input Test",20,20,640,480,Null,WINDOW_TITLEBAR)
Local hCanvas:TGadget = CreateCanvas(0,0,ClientWidth(hWin),ClientHeight(hWin),hWin)

SetGraphics CanvasGraphics(hCanvas)
EnablePolledInput()
ActivateGadget(hCanvas)

Repeat
	If KeyDown(KEY_LEFT) Then DrawText("Left",15,15)
	If KeyDown(KEY_RIGHT) Then DrawText("Right",15,30)
	If KeyDown(KEY_UP) Then DrawText("Up",15,45)
	If KeyDown(KEY_DOWN) Then DrawText("Down",15,60)	
	If MouseDown(1) Then DrawText("Mouse left",15,75)
	If MouseDown(2) Then DrawText("Mouse right",15,90)
	DrawText("Press arrow keys or click mouse to test polled input!",5,GraphicsHeight()-20)
	Flip;Cls
Forever