• 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
NSTextView subclass - paste into table cell breaks table?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView subclass - paste into table cell breaks table?


  • Subject: NSTextView subclass - paste into table cell breaks table?
  • From: Jim Correia <email@hidden>
  • Date: Sat, 7 Oct 2006 12:56:46 -0400

I have an NSTextView subclass. I've overridden - readSelectionFromPasteboard:type: so that I can perform a "filter" on the attributed string before pasting/dropping it into the text view.

I think I've implemented the method correctly according to the docs. (If I haven't, where have I gone wrong?)

BEGIN CODE SNIPPET:

/* if the type is interesting, and we got some data off the pasteboard */

NSAttributedString *attributedString = [[[NSAttributedString alloc] initWithPasteboard: pboard options: nil documentAttributes: NULL error: &error] autorelease];
if (attributedString == nil) {
return NO;
}


attributedString =  /* do some processing on the string */

NSRange range = [self rangeForUserTextChange];
if ([self shouldChangeTextInRange: range replacementString: [attributedString string]]) {
[[self textStorage] replaceCharactersInRange: range withAttributedString: attributedString];
[self didChangeText];
}


==END

When I paste the text into a table cell (top middle in the example) it "breaks" the table.

Have I done something wrong, or am I running into a bug? In either case, is there any corrective action I can take?

Thanks,
Jim

PNG image

 _______________________________________________
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: Re: delegate question
  • Next by Date: How to check if an image has an alpha channel?
  • Previous by thread: Your information [:.VIRUS.:]
  • Next by thread: How to check if an image has an alpha channel?
  • Index(es):
    • Date
    • Thread