• 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
Re: Subclassing NSDocumentController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSDocumentController


  • Subject: Re: Subclassing NSDocumentController
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Wed, 14 Jul 2004 17:46:21 -0700

Hello...

The nextKeyView and the responder chain are two very different things. The view that the nextKeyView outlet points to isn't part of the responder chain, it is used to implement the "tab to go to the next box / control" functionality.

In one of the next few chapters (Hillegass 1st Ed, pg 251) there is a section titled "Nil-Targeted Actions" that describes the responder chain, so you might want to skip ahead and read that little section.


The responder chain is the collection of all the objects that will get a chance to respond to a particular action until one of them responds to it. The first responder is the "active" view or object that is at the head of the responder chain.

What you are doing with nextKeyView is setting up an order for changing the active view, in other words switching between first responders. When you hit tab you will move to the view you have designated with the nextKeyView outlet, shift-tab will take you back to the previous view in the chain.


I can't be sure about the double checking of acceptsFirstResponder in this particular case without a bit of testing, but it is probably normal. It's likely that what is happening is that the acceptsFirstResponder method is being called when view is checking if it should become the first responder, and called again as sort of a sanity check in the code where the view actually becomes the first responder.


Hope that helps,

Louis



http://developer.apple.com/documentation/Cocoa/Conceptual/ BasicEventHandling/index.html

from that:

The first responder is typically the selected NSView within the NSWindow, and its next responder is its containing NSView (also called its superview), and so on up to the NSWindow itself.

i'm just on the responders and keyboard events chapter of Hillegass's book (1st version) and in the little app in that chapter (chapter 14) the responder chain is dictated by connecting the nextKeyView's in interface builder. the views being assigned nextKeyView are not at all necessarily superviews -- there seems to be a contradiction there.

also, in the app from the book, when the custom view gets clicked on when it wasn't first responder acceptsFirstResponder gets called twice, and when the custom view gets tabbed to acceptsFirstResponder gets called four times. -- is this usual / to be expected or have i done something wrong do you think?

thanks, ben
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Subclassing NSDocumentController (From: Ben Dougall <email@hidden>)

  • Prev by Date: Low level system status?
  • Next by Date: Re: [options] Cocoa GUI Client to web based SQL database
  • Previous by thread: Re: Subclassing NSDocumentController
  • Next by thread: Distributed Objects: Passing my objects to distant object
  • Index(es):
    • Date
    • Thread