• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Of modal windows and nil-targeted menu actions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Leopard crash in standard open and save panel
  • Next by Date: NSTableView and displaying c strings
  • Previous by thread: Leopard crash in standard open and save panel
  • Next by thread: NSTableView and displaying c strings
  • Index(es):
    • Date
    • Thread