Window focus events in Cocoa

Posts: 16
Joined: 2009.01
Post: #1
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?
Quote this message in a reply
Posts: 283
Joined: 2006.05
Post: #2
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.
Quote this message in a reply
Posts: 16
Joined: 2009.01
Post: #3
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Multiple Key Presses - Cocoa Events JordanReed 2 7,466 Jun 23, 2012 07:41 AM
Last Post: JordanReed
  Detecting window focus events Coyote 2 5,108 Oct 23, 2009 03:01 PM
Last Post: Coyote
  No window focus in Carbon app on 10.5 withnail 3 5,556 Jan 9, 2008 02:25 PM
Last Post: OneSadCookie
  Newbie Cocoa query - setTitle: at window init sealfin 3 6,986 Nov 14, 2005 10:32 AM
Last Post: akb825
  Cocoa: Mouse location while dragging window Fenris 4 7,264 Jul 14, 2005 04:46 PM
Last Post: Fenris