• 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
Re: Getting NSTIFFPboardType data from an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting NSTIFFPboardType data from an NSTextView


  • Subject: Re: Getting NSTIFFPboardType data from an NSTextView
  • From: Keith Blount <email@hidden>
  • Date: Sat, 2 Oct 2004 16:21:28 -0700 (PDT)

Many thanks for the reply, Robert. After researching
some more and hazarding some guesses, I overrode
NSTextView's writablePasteboardTypes: and set
NSTIFFPboardType as one of the pasteboard types, then,
as you suggested, I overrode
dragImage:at:offset:event:pasteboard:source:slideBack:,
and added the following code:

[pboard setData:
[[[[self textStorage]
attribute:NSAttachmentAttributeName atIndex:0
effectiveRange:nil] fileWrapper] regularFileContents]
forType:NSTIFFPboardType];

This works great - I can now drag a picture from the
text view into the image view. Obviously, this is test
code, and only works if the picture is the first
character in the text view (atIndex:0), so I have to
refine it to work for the selected range. But the
refinement is fairly minor now that I have got the
basics working.

So many thanks again for giving me pointers on where
to start!
Keith

>You could try subclassing the textview and overriding
the textview's
>dragImage:at:offset:event:pasteboard:source:slideBack:
method.
>Determine (you'd have to research this, I've never
used RTF) if the
>selection is an image. If it is
>get the image (research again :-) ),  reset the
pasteboard (redeclare
>it's types and add the image data)
>and then call [super
>dragImage:at:offset:event:pasteboard:source:slideBack:].
>
>I don't know if it will work, but it is the first
thing I would try.
>
>Bob



__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
_______________________________________________
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: Scripting and objectSpecifier issue
  • Next by Date: MVC paradigm: multiple controllers?
  • Previous by thread: [ANN] Extending MacPAD - public discussion
  • Next by thread: MVC paradigm: multiple controllers?
  • Index(es):
    • Date
    • Thread