Re: Newbie question adding text to NSTextView
Re: Newbie question adding text to NSTextView
- Subject: Re: Newbie question adding text to NSTextView
- From: Daniel T <email@hidden>
- Date: Sun, 14 Nov 2004 22:18:55 -0500
Perfect! Thanks. I found replaceCharatersInRange (after my first post)
but was having trouble with the scrolling. (I was almost resigned to
putting the new text at the top of the output window... Dare to be
different?)
Scott, I tried insertText, but it never seemed to display.
On Nov 14, 2004, at 9:27 PM, Philippe Hausler wrote:
- (void)appendMyTextView:(NSString *)newText
{
NSRange theEnd=NSMakeRange([[MyTextView string] length],0);
[MyTextView replaceCharactersInRange:theEnd
withString:newText]; // append new string to the end
theEnd.location+=[bufferedLog length]; // the end has moved
[MyTextView scrollRangeToVisible:theEnd];
}
I put this in so many of my apps its not even funny, its great for
appending a log or in this case chat too.
Hope it works in your situation,
Philippe Hausler
On Nov 14, 2004, at 9:49 PM, Scott Ribe wrote:
Doh. What you want then is the insertText method.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden