Created
December 21, 2010 08:36
-
-
Save destroytoday/749666 to your computer and use it in GitHub Desktop.
How to unfocus a NativeWindow for unit testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At the moment, AIR only has activate() and bringToFront() for focusing windows, | |
// but it lacks any methods for unfocusing. Though unfocusing a window is a pretty | |
// rare action, it's necessary for some unit tests. Mine test a minimize menu item | |
// that is expected to be disabled if no windows are focused. I don't see the AIR | |
// team adding a deactivate() method, but I do see the possibility of setting | |
// NativeApplication.nativeApplication.activeWindow to null. Right now, it's read-only. | |
var window:NativeWindow = NativeApplication.nativeApplication.activeWindow; | |
window.visible = false; | |
window.visible = true; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment