iDevGames Forums
giving my application focus (make it appear on top) - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: giving my application focus (make it appear on top) (/thread-1010.html)



giving my application focus (make it appear on top) - Najdorf - Jul 15, 2009 11:59 AM

I noticed that the first time a downloaded app runs, the finder asks you if you're sure you want to run it. Consequently, the app loses focus, as the finder gets it.

How do I give my application focus again (on awakefromnib)?


giving my application focus (make it appear on top) - FlamingHairball - Jul 15, 2009 12:19 PM

Hmm... I haven't noticed this behavior.

However, NSApplication has a function for this purpose(untested).

Code:
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];

Let me know if that works. Smile


giving my application focus (make it appear on top) - Najdorf - Jul 15, 2009 12:41 PM

cool i'll try that... I guess I'll have to upload my app on the internet to test it though Wink

It does seem to do that for most apps I tried, maybe it can be considered a bug for apple.


giving my application focus (make it appear on top) - ThemsAllTook - Jul 15, 2009 02:31 PM

This is an OS bug, and should be filed as one. You risk creating an infuriating user experience if you steal focus on startup. As an OS bug, users will be accustomed to the experience and know to bring your app to the front after the first launch; when the bug is fixed, your app will start working without you having to add dodgy workaround code that can focus your app when the user didn't request it.


giving my application focus (make it appear on top) - unknown - Jul 15, 2009 04:29 PM

Warning

This thread has been downloaded from the internet, are you sure you want to read it?

http://discussions.apple.com/thread.jspa?threadID=2051462&stqc=true