Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Of modal windows and nil-targeted menu actions



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.