开发者

Maximize an AIR app using the keyboard

开发者 https://www.devze.com 2022-12-31 05:41 出处:网络
This boils down to being able to listen to key presses when the application doesn\'t have the focus. I\'ve tried adding listeners to both stage and NativeApplication, but when the app is mi开发者_Stac

This boils down to being able to listen to key presses when the application doesn't have the focus. I've tried adding listeners to both stage and NativeApplication, but when the app is mi开发者_StackOverflow社区nimized it doesn't seem to listen to key events.

Any idea how this could be achieved?

Just for the record, I'm trying to implement an app that behaves in the way Spotlight does. It runs on the background and it appears to the user after a keyboard shortcut combination.

If this is not possible, I think I would have to use some sort of helper app to listen to the keys and pass them on to the AIR app via NativeProcess, but it seems a little bit too complicated.

I'm planning to get this working on AIR 2 beta in at least Win and Mac.

Thanks.

J


I think you are right when you say you will need a helper app since I am not aware of a way for AIR to detect key presses when it has resigned focus. Another option though perhaps would be to have an icon on the task bar the user can click just like spotlight or use the task switcher to give the app focus and use the application focus event to bring up your UI?

Not what you were looking for, but maybe some other options to consider.


You can listen to Key presses only when your Air app has the focus. This is a security feature as otherwise you can easily make a key logger application. See if you can work around using putting a maximize option from a system tray icon.

0

精彩评论

暂无评论...
验证码 换一张
取 消