Of modal windows and nil-targeted menu actions
Of modal windows and nil-targeted menu actions
- Subject: Of modal windows and nil-targeted menu actions
- From: Allen Smith <email@hidden>
- Date: Fri, 30 Nov 2007 15:25:10 -0800
It has been explained how to make non-nil targeted menus autoenable
properly in the presence of a modal window:
http://www.cocoabuilder.com/archive/message/cocoa/2004/10/7/119051
And the documentation now gives a full list of all the objects one
might find in the responder chain:
http://developer.apple.com/documentation/Cocoa/Conceptual/
EventOverview/EventArchitecture/chapter_2_section_6.html
What isn't explained is that nil-targeted menus climb different
responder chains depending on the class of the modal window:
NSWindow:
Included: the window itself, window's delegate, window's
NSWindowController, application object, application delegate
Excluded: nothing*
NSPanel:
Included: the key window itself, key window's delegate, key window's
NSWindowController
Excluded: main window, main window delegate, main window's
NSWindowController, application object, application delegate
* Even when an NSWindow is run modal, it still becomes both key and
main. So only one window's responder chain shows up here.
NSPanel's behavior is generally more desirable; I got to looking at
this because I didn't want my application delegate responding when
there was a modal window up. Lastly, beware that -[NSApplication
targetForAction:to:from:] traverses the responder chain as
documented, without consideration of modality.
Allen
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden