• 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
Appending NSStrings to an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Appending NSStrings to an NSTextView


  • Subject: Appending NSStrings to an NSTextView
  • From: David Rehring <email@hidden>
  • Date: Sun, 30 Dec 2001 23:15:47 -0800

I need to append an NSString to an NSTextView and there doesn't seem to be a
non-hackish way of doing it.

Right now, to do this, I'm:

NSRange currentRange = [textView selectedRange];
NSRange allRange;
NSRange appendRange;

[textView selectAll:self];
allRange = [textView selectedRange];
[textView setSelectedRAnge:currentRange];

appendRange = NSMakeRange(NSMaxRange(allRange), 0);

[textView replaceCharactersInRange:appendRange withString:appendString];

This doesn't feel like the one-true-way. What would a more appropriate way
to append text be?

Later,
--
David Rehring Psychos do not explode when light hits
Senior Software Engineer them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!


  • Follow-Ups:
    • Re: Appending NSStrings to an NSTextView
      • From: David Rehring <email@hidden>
    • Re: Appending NSStrings to an NSTextView
      • From: Thomas Lachand-Robert <email@hidden>
    • Re: Appending NSStrings to an NSTextView
      • From: Richard Schreyer <email@hidden>
  • Prev by Date: Doc-Based Architecture and Two File Extensions
  • Next by Date: NSFont userFontOfSize vs setUserFixedPitchFont [resent using correct account]
  • Previous by thread: Doc-Based Architecture and Two File Extensions
  • Next by thread: Re: Appending NSStrings to an NSTextView
  • Index(es):
    • Date
    • Thread