SOLVED: Using the tab key to cycle through custom NSViews?

Sending this for the archives (hope I can save some other poor soul
some grief).
---

I cannot say that this is the best way to solve the problem of using
tab to cycle through custom NSViews, but I did finally get it to work.

The key was this method in NSWindow:

NSWindow: selectNextKeyView:

This action method searches for a candidate key view and, if it finds
one, invokes makeFirstResponder: to establish it as the first
responder.
- (void)selectNextKeyView:(id)sender
Discussion
The candidate is one of the following (searched for in this order):
* The current first responder's next valid key view, as returned by
NSView's nextValidKeyView method
* The object designated as the receiver's initial first responder
(using setInitialFirstResponder:) if it returns YES to an
acceptsFirstResponder message
* Otherwise, the initial first responder's next valid key view,
which may end up being nil.

At first, I tried to implement performKeyEquivalent: in my view,
looking for the tab key. What I observe is that NSWindow passes the
tab key down the responder chain starting with the
initialfirstResponder (not the firstResponder!). When I switched to
keyDown:, then it went right to the first responder. [Thus, you can
use either method subject to the differences noted.]

Thus, the full set of custom NSView methods I used for cycling is below: