NSTextView subclass - paste into table cell breaks table?
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
_______________________________________________
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