giving my application focus (make it appear on top)

Member
Posts: 749
Joined: 2003.01
Post: #1
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)?

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Moderator
Posts: 624
Joined: 2007.09
Post: #2
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

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #3
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.

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Moderator
Posts: 1,562
Joined: 2003.10
Post: #4
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.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #5
Warning

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

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

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Post Reply