Gnarly problem getting a NSResponder inserted into the action chain.

  • The app has windows with several custom views in them that should
    respond to certain menu commands and keyboard input. Normally, one of
    them is the first responder.

    However, I have a combo box in the toolbar, and a NSTextView in a
    drawer, and either can become the first responder when clicked into.
    However, even if one of these is being edited, one of the images in
    the window is still primary, and should also be in the action
    responder chain (to respond to menu items).

    So, when window's first responder is not one of these images (and
    thus one of the text controls), I had the windowController's
    nextResponder return the active image view. This sort of works, but
    it results in a responder chain loop; the image view returns its
    superview, back to the window, then the window controller, and again
    back to the image view through the windowController nextResponder

    The hack I came up with is to have the windowController set a
    "oneshot" flag for the image view; with this flag set, the image
    returns nil when asked for its nextresponder, then it resets the
    flag. The end result is that everything now appears to be working as

    However, this solution leaves me a bit queasy, so I'm hoping someone
    on the list has hit this same problem and has a better solution to


    PS: I already read and reread the "Event Architecture" document that
    describes the Responder Chain looking for some other alternative.
previous month october 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 31        
Go to today