Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to order a window to front if you are not in the Application in Objective-C

Is there a way to make a "makeKeyAndOrderToFront" without beeing in the Application?

If I am in Safari and in the Menu Bar there is a MenuItem to my App, after I press this, i want to show a window of my App in the Front (makeKeyAndOrderToFront makes this just if you are in the Application).

Which way can I use? And how can I animate this Window (like Tweeties Add new Tweet -> atebits.com).

Thank you!

like image 835
ahmet2106 Avatar asked Apr 07 '10 14:04

ahmet2106


1 Answers

As you've discovered, changing the window order within your application does not have any impact on which application is active. You can bring your application to the foreground by activating it:

[NSApp activateIgnoringOtherApps:YES];

If your application had a dock icon the behavior would be similar to the user clicking on it.

like image 159
Matt Stevens Avatar answered Nov 16 '22 00:11

Matt Stevens