No keyboard input in windowed mode?

BlitzMax Forums/BlitzMax Programming/No keyboard input in windowed mode?

Captain Darius(Posted 2011) [#1]
Hi Everyone,

I've gotten back into Blitz after some time away. I am running BlitzMax 1.43b under OSX Lion. I used to run under windows.

Anyway, I'm having an issue in that when I run my game in Windowed mode, I get no keyboard input, even though the app has focus.

Is there anything I have to do to capture the keyboard in windowed mode?

Thanks!


Midimaster(Posted 2011) [#2]
I don't know, whether this is a problem of 1.43b. But normaly it should work as expected on OSX also in an windowed mode.

Perhaps you have some code for us?

this test works on 1.41:
Graphics 400,300
Local Key%
Repeat
	Cls
	DrawText "TEST 1:    K E Y D O W N ",100,40
	DrawText "(press <S> to test",40,70
	DrawText "<ESC> to continue",250,250
	key=KeyDown(KEY_S) ' expects Key <S>
	DrawText "yes/no=" + Key,40,100
	Flip 1
Until KeyHit(Key_escape)
Delay 100
Repeat
	Cls
	DrawText "TEST 2:   W A I T K E Y ",100,40
	DrawText "(press <ANY KEY> to test",40,70
	DrawText "<ESC> to continue",250,250
	DrawText "keycode=" + Key,40,100
	Flip 1
	key=WaitKey() ' expects any Key
Until Key=27



GfK(Posted 2011) [#3]
Depending on how you're creating the graphics object, then you may have to call EnablePolledInput(). It isn't done by default when you use CreateGraphics(), for example.


Captain Darius(Posted 2011) [#4]
Midimaster,

I copied your code directly into the ide, compiled it and ran it and it does not work. The app doesn't respond to me hitting the keyboard and then after a few hits I get the old "keyboard beep."

I also tried adding "EnablePolledInput()" and that didn't work either.

I am running BlitzMax 1.43b under Lion on a recent Intel Mac Pro (last year's model).

P.S. It does work just fine if I run in full screen.

Last edited 2011


Captain Darius(Posted 2011) [#5]
Update: I had "Build GUI App" turned off. If I turn it on, it works!