(Adobe Air) Bring a window to front by clicking the systemTrayIcon
While developing an AIR application, I had an issue with bringing the application to front (above all other windows) when clicking the systemTrayIcon.
Usually, you would use the method:
1. systemTrayIcon.addEventListener( "click" , function () {
2. window.nativeWindow.orderToFront();
3. });
But doing so will result in… actually nothing at all. The window doesn’t move.
Using the same code on a menu item of the SystemTrayIcon will work, but not on the click action of the Icon itself.
Workaround:
Set the window property alwaysInFront to true and then to false:
1. systemTrayIcon.addEventListener( "click" , function () {
2. window.nativeWindow.alwaysInFront = true ;
3. window.nativeWindow.alwaysInFront = false ;
4. });
Not the way it should be, but it works…