• 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 fun fun fun!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView fun fun fun!


  • Subject: NSTextView fun fun fun!
  • From: Jonathan Wight <email@hidden>
  • Date: Mon, 24 Nov 2003 15:13:15 -0600

I have a custom NSTextAttachment that I want to be able to merrily drag
around an NSTextView until UT2K4 comes out (mmmm, telefragging with
vehicles).

To enable dragging the attachment *from* the text view I have to supply
the following delegate methods:

- (NSArray *)textView:(NSTextView *)view
writablePasteboardTypesForCell:(id <NSTextAttachmentCell>)cell
atIndex:(unsigned)charIndex
- (BOOL)textView:(NSTextView *)view writeCell:(id
<NSTextAttachmentCell>)cell atIndex:(unsigned)charIndex
toPasteboard:(NSPasteboard *)pboard type:(NSString *)type

Not a problem. I declare my own pasteboard type and return it in the
first method, and in the second I add my data to the pasteboard.
Simple!

To enable dragging the attachment *to* a text view I have to (according
to comments in NSTextView.h) subclass NSTextView and override some or
all of the following methods:

- (NSArray *)readablePasteboardTypes
- (NSArray *)acceptableDragTypes
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard
type:(NSString *)type

In the first two methods I sneakily snuck my custom pasteboard type
into the start of the types arrays.

Unfortunately the 'type' I receive in the third method isn't MY custom
type. In fact the type I get is "NeXT RTFD pasteboard type" which is no
good to me at all!

Has anyone successfully got dragging custom types into an NSTextView
working!

Jon.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Database applications in OS X
  • Next by Date: Displaying color code in stead of colored text?
  • Previous by thread: Re: Network-based data source for NSOutlineViews
  • Next by thread: Displaying color code in stead of colored text?
  • Index(es):
    • Date
    • Thread