Window focus events in Cocoa - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Window focus events in Cocoa (/thread-1901.html)
Window focus events in Cocoa - Jar445 - Jan 18, 2009 05:39 PM
I have an application with a single (ns)window, and I'm trying to figure out how to detect window focus events like when it's minimized to the dock or the user is focused on another application, or if the window is on another space in Leopard.
I've read some documentation on event handling, but nothing seems to be mentioned about window focus events. What am I missing?
Window focus events in Cocoa - maximile - Jan 18, 2009 05:47 PM
There are relevant methods in the "Managing Key Status" section of the NSWindow documentation. Also the "Managing Active Status", "Hiding Applications", "Managing Windows" sections of the NSApplication docs.
Window focus events in Cocoa - Jar445 - Jan 18, 2009 06:02 PM
OK. From reading those it looks like my best bet is to give my NSApplication object a delegate that handles applicationDidBecomeActive:, applicationDidResignActive:, applicationDidHide:, and applicationDidUnhide:. Thanks.