• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie question adding text to NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: making editable/clickable a NSTextField inside NSStatusBar
  • Next by Date: link flag in XCode?
  • Previous by thread: making editable/clickable a NSTextField inside NSStatusBar
  • Next by thread: link flag in XCode?
  • Index(es):
    • Date
    • Thread