[comp.sys.next] scrollingTextField

tsui@silver.bacs.indiana.edu (08/15/89)

I need a textfield that scrolled. And here is what i did:

...

textField=[TextField newFrame:&aRect];
[textField setStringValue:""];
[[textField cell] setScrollable:YES];
[textField setAutodisplay:YES]; /* not necessary */

...

But the textfield did not scroll to follow the typing. I have to
creat a Form with one entry to do it. But why?  I am wondering what
I am missing...  Thanks

--yufeng

tsui@silver.bacs.indiana.edu

jpd00964@uxa.cso.uiuc.edu (08/16/89)

/* Written 10:26 pm  Aug 14, 1989 by tsui@silver.bacs.indiana.edu in uxa.cso.uiuc.edu:comp.sys.next */
/* ---------- "scrollingTextField" ---------- */

> I need a textfield that scrolled. And here is what i did:
> textField=[TextField newFrame:&aRect];
> [textField setStringValue:""];
> [[textField cell] setScrollable:YES];
> [textField setAutodisplay:YES]; /* not necessary */

> But the textfield did not scroll to follow the typing. I have to
> creat a Form with one entry to do it. But why?  I am wondering what
> I am missing...  Thanks

/* End of text from uxa.cso.uiuc.edu:comp.sys.next */

You need to call scroll yourself.  One way would be in your text objects
delegate.  
I think you may run into similiar problems I had with mouseDown, however.  
Appearently, to speed things up, once you type a key, the Text Object enters
a modal loop and will not give you back control until you do something besides
entering key strokes.  
You need to either change the frame size, or call scroll.  Neither of which
is called in the modal loop you are in.

Actually, there is one way out.  It involves you rewritting the text class.
because of its inheritance, you can get away with only rewritting the keyDown:
message.  I don't know how difficult this will be though.

Michael Rutman
Softmed