Dragging attachments out of NSTextView

Discussion in 'Mac Programming' started by Monaj, Feb 10, 2010.

  1. Monaj macrumors regular

    May 24, 2009
    Hi all,

    I am working on mac mail like feature-
    1. dragging a file on body of message being composed and showing it as icon, over it.
    2. dropping the icon of file from message body back to desktop or to any folder, so that it gets downloaded in it.

    I am able to implement the first point using NSTextView and calling method: -(void)setImportGraphics: with parameter YES... but in second point I am caught!
    whenever I try to drag the icon out of text view it appears as "Untitled clipping" in destination folder.:eek:

    I tried to do some search over net and found this link: http://lists.apple.com/archives/Cocoa-dev/2004/May/msg01813.html, but there is no reply to the post :(

    Can anyone help me to resolve the 2nd point so that in place of "Untitled clipping" actual file gets downloaded to destination folder:confused:


  2. Sydde macrumors 68020


    Aug 17, 2009
    First look at the NSTextView delegate method -textView:draggedCell:inRect:event:atIndex:

    Then look at the NSDraggingSource protocol and NSPasteboard (if interest is the constant NSFilesPromisePboardType). You may have to supply a filename on your own.

Share This Page