Detecting window focus events

Member
Posts: 35
Joined: 2009.10
Post: #1
I have a window (in Cocoa) and I need to be able to tell when it is hidden/shown, is minimized/unminimized, and looses/gains focus. Strangely, I can't seem to find any documentation that says how to do this. Blush
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #2
You can observe the relevant notifications (listed in the section at the bottom of the NSWindow docs), or you can subclass the window and override the relevant methods (e.g. becomeKeyWindow).
Quote this message in a reply
Member
Posts: 35
Joined: 2009.10
Post: #3
Thank you. And I've just discovered the wonderful world of window delegates.

What's the difference though between a window becoming the key window and a window becoming the main window?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  detecting 2 touches, is order of touch significant? sefiroths 4 9,886 Sep 30, 2011 07:29 AM
Last Post: @iOS_blog
  Detecting OS and Mac version xiotex 2 3,045 Nov 14, 2009 03:02 PM
Last Post: xiotex
  Window focus events in Cocoa Jar445 2 5,323 Jan 18, 2009 06:02 PM
Last Post: Jar445
  No window focus in Carbon app on 10.5 withnail 3 3,871 Jan 9, 2008 02:25 PM
Last Post: OneSadCookie
  Mouse events for an openGL window majestik666 5 7,425 Jul 5, 2005 06:15 PM
Last Post: majestik666