[comp.sys.next] TextField vs. single-cell Form

eps@toaster.SFSU.EDU (Eric P. Scott) (05/22/91)

Both Tab and Back-Tab are equivalent to selectText: for a
TextField with no nextText.  Tab works "properly" for a Form
containing a single FormCell, but Back-Tab instead resigns
the first responder!  Trying to point it back at *itself* using
setPreviousText: doesn't work (I guess it treats self as nil?).
Nor can one use something [a Text delegate] like

- textDidEnd:textObject endChar:(unsigned short)whyEnd
{
    if (whyEnd == NX_BACKTAB) [myForm selectTextAt:0];	// no effect
    return self;
}

[not that anyone would actually *want* to do this :-) ] since
it's messaged _before_ the FormCell deselects (although it could
presumably queue a deferred select, ick).


What does seem to work is setting the Form's nextText to an
object containing:

- setPreviousText:anObject {
    [anObject setPreviousText:self];
    return self;
}

- selectText:sender {
    [sender selectText:self];
    return self;
}

...or, better, dispense with the -setPreviousText: and diddle an
IB outlet method (which the "improved" 2.0 IB will no longer
automagically generate, grr), e.g.


- setMyForm:anObject
{
    myForm=anObject;
    [myForm setPreviousText:self];
    return self;
}

- selectText:sender {
    [sender selectText:self];
    return self;
}



I'll treat this as an AppKit bug (with workaround) unless someone
can come up with a *good* explanation for this [mis]behavior.
Note that Forms with more than one FormCell do work the way I'd
expect.

Just thought y'all'd like to know.
(I think this warrants an entry in NextAnswers...)

					-=EPS=-
-- 
InterfaceBuilder lowers programmer productivity!
I've worked on this project for two whole days and still don't
have a line of code to show for it!  :-) :-) :-)