Pedro Vieira
Pedro Vieira

Reputation: 3370

How to make a Status Bar Application catch 'applicationDidResignActive:' with other Status Bar Apps?

Right now I'm developing a Status Bar Application and I need to know when the app loses focus, every time. So I am currently using applicationDidResignActive: for that but that's not catching when I open another Status Bar App's menu.
How can I make applicationDidResignActive: (or any other method) catch every time my app loses focus, even when opening another Status Bar App?

Upvotes: 2

Views: 586

Answers (1)

IluTov
IluTov

Reputation: 6862

I think what you're actually looking for is when the window looses focus.

You can use the following NSWindowDelegate method:

windowDidResignMain:

You also have to set canBecomeMainWindow to YES

- (BOOL)canBecomeMainWindow {
    return YES;
}

Make sure to connect it to the delegate and you should be fine.

Upvotes: 3

Related Questions