Get Key without Listener?

Hi guys!

Is it possible to get somehow if the Key pressed or not? Without KeyListener.

My issue is - when i press Alt+Tab - then my Ananlog/Action keyEvent works incorrectly sometimes.

Thanks.

There is no such thing as “key is pressed or not”… only key down and key up events. So you can’t query “is key ‘f’ pressed” if that’s what you mean.

Other than that, we might have to know what “works incorrectly” means.

@pspeed said: There is no such thing as "key is pressed or not"... only key down and key up events. So you can't query "is key 'f' pressed" if that's what you mean.

Other than that, we might have to know what “works incorrectly” means.

I have issues with ALT/Shift/Ctrl keys. I set boolean if these keys are pressed or not in the action key event. And when I press Alt+Tab - JME app is set to pause. But Alt/Ctrl/Shift - can be released at this time when the app is paused.

@mifth said: I have issues with ALT/Shift/Ctrl keys. I set boolean if these keys are pressed or not in the action key event. And when I press Alt+Tab - JME app is set to pause. But Alt/Ctrl/Shift - can be released at this time when the app is paused.

Meaning you detect the release or you don’t detect the release?

There is really no good solution to this problem, though.

1 Like

You mean listen when the app is not active? That would require an lower level hook. Keylogger style. More than likely OS specific, too.

And by the way, if you are referring to JME’s “pause on lost focus” then you should turn that off. It’s an extremely bad way to pause a game anyway.

@pspeed said: And by the way, if you are referring to JME's "pause on lost focus" then you should turn that off. It's an extremely bad way to pause a game anyway.

I use it for my editor. Ok, i get you. Possibly i can solve it to set booleans per update. Thanks!

@jayfella said: You mean listen when the app is not active? That would require an lower level hook. Keylogger style. More than likely OS specific, too.

Yep right.