[comp.sys.next] Appending to Text objects

adams@skippy.berkeley.edu (Jeffrey P. Adams) (06/07/90)

I'm trying to write my first application in Objective-C and with
Interface Builder.

It's a sort of file-search routine:  It reads in stuff from a standard
file, and then displays a bunch of text.  I'm finding it awkward to
write into a ScrollView, though.  I copied the ScrollView from the
Pallettes window, and in my code, I message the ScrollView to tell
me what its DocView (which is a Text object) is.  But how to append
text to a DocView?  This seems lke it should be common enough to
have been made simple, but I can't figure it out.  I see two ways:

I can declare a very long string in my code which contains the text
in the Text object.  Then, when I want to write to the Text object,
I can use sprintf or whatever to write into the string, and then
do a [theDocView setText:string] command.  That's a real hassle, and
takes a LONG time when the text becomes large.

Or, I could just write it all to a file, and at the end, tell the
Text object to read in the file.  The problem there is that the
user doesn't get to see it grow, and they can't abort it if they
see it's doing the wrong search or whatever.  (The program may
take 5 minutes to run sometimes).

So help me:  How do you display text incrementally in a ScrollView?



Jeff Adams
adams@ucscl.ucsc.edu