Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top