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:

    And the documentation now gives a full list of all the objects one
    might find in the responder chain:

    What isn't explained is that nil-targeted menus climb different
    responder chains depending on the class of the modal window:

    Included: the window itself, window's delegate, window's
    NSWindowController, application object, application delegate
    Excluded: nothing*

    Included: the key window itself, key window's delegate, key window's
    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.

previous month december 2007 next month
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today