开发者

Defocus application when last window closes

Not sure if t开发者_开发百科his is the right word to use but i need to "Defocus" my application when the user closes the last window (Order it to the background). Preferably giving the focus to the application that was running in the foreground before my application became foreground. How do I go about achieving this?

Thanks,

Robert


Try using -[NSApplication deactivate].

[[NSApplication sharedApplication] deactivate];

If that doesn't do what you want (which is entirely likely), try this:

[[NSApplication sharedApplication] hide:nil];
[[NSApplication sharedApplication] unhideWithoutActivation];

Note that this is not necessarily something that you should be doing. If I'm picturing what your application is doing correctly, it seems that you should consider making it an agent application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜