• 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 - custom pasteboard types and tables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView - custom pasteboard types and tables


  • Subject: NSTextView - custom pasteboard types and tables
  • From: Keith Blount <email@hidden>
  • Date: Sun, 22 Jan 2006 15:22:36 -0800 (PST)

Hi,

I've implemented my own custom pasteboard type for
NSTextView by subclassing it and overriding
-writeSelectionToPasteboard:type:,
-readSelectionFromPasteboard:type: and the other
relevant methods, but it seems that no matter what I
do, tables get screwed up (by "tables", I mean the
text tables introduced in 10.4 which can be added via
-orderFrontTablePanel:). I'm adding my own custom
pasteboard type because I use several custom
attributes - however, these attributes don't have to
exist for the problems I am seeing to arise.

To add to the pasteboard, all I am doing is getting an
attributed substring of the text storage based on the
selection range (or ranges) and then adding it to the
pasteboard as data. Problems:

- If I just archive the attributed string using
NSKeyedArchiver, the border attributes of tables get
lost, so that when I paste it again, the table has
white borders except for the bottom one. Strange.
- Even if I use -RTFDFromRange:documentAttributes: to
store my string (as an experiment to see if I was
missing something obvious), I get weird results -
table cell data seems to get copied, so that if I copy
some text from a table cell and pass it into another
table cell, a newline gets added, or I get a cell
within a cell. Given that this doesn't happen in the
default implementation, I am guessing that NSTextView
does some extra magic to maybe strip table attributes
in these methods (?).

I don't really know what's going on here. These
problems only arise when a table is present in the
text. Given that tables were only introduced in Tiger,
maybe there's still some screwiness there...? If
anyone has any ideas, I would be very grateful.

Many thanks in advance for your help,
Keith


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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: Database frameworks for Cocoa
  • Next by Date: Re: Incompatible pointer type from NSManagedObject's validateValue:forKey:error method
  • Previous by thread: Re: KVC with an path, AppleScript and InterfaceBuilder
  • Next by thread: NSImageView Subclass Leak?
  • Index(es):
    • Date
    • Thread