Keydown vs. GUI
BlitzMax Forums/MaxGUI Module/Keydown vs. GUI| 
 | ||
| Has anyone else ahd troubles detecting keyboard input while using a GUI window? For Example: Detecting if escape is pressed and then closing the window I thought it may have been my program but it wouldn't work the simple little CreateWindow demo program. What's Up? | 
| 
 | ||
| You'll need a canvas/panel to capture EVENT_KEYDOWN 
' createwindow.bmx
Strict 
Local window:TGadget
window=CreateWindow("My Window",40,40,320,240)
Global panel:TGadget = CreatePanel(0,0,320,240,window,PANEL_ACTIVE)
ActivateGadget pan
While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
		Case EVENT_KEYDOWN
			Select EventData()
				Case KEY_ESCAPE
					End
			End Select
	End Select
Wend
 | 
| 
 | ||
| or use enablepolledinput() dos'nt seem to work reliably under Linux. |