• 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: Newbie: Getting path of file dragged onto NSImageView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Getting path of file dragged onto NSImageView


  • Subject: Re: Newbie: Getting path of file dragged onto NSImageView
  • From: Esteban Uribe <email@hidden>
  • Date: Wed, 09 Apr 2003 13:34:20 -0700

Hi,

On Wednesday, April 09, 2003, at 01:03PM, onegecko.com <email@hidden> wrote:

>Okay,
>
>Doing a desperate and epiphanic search on cocoa.mamasam.com for "drag drop
>file path" -- don't know why i didn't think of that at 02:00 this morning
>-- I found a message saying to override the inherent drag and drop
>capabilities of NSImageView
><http://cocoa.mamasam.com/COCOADEV/2002/05/2/35227.php>. Progress! :D
>

Yeah the message you refer to explains it correctly (though with no sample)
I just did this a couple of days ago, though i currently dont have access
to my cocoa dev machine, so you'll have to wait for onegecko.com to post
sample code, or until later in the day when i can do so.

Basically you have to subclass NSImageView, and override the
NSDraggingDestination protocol methods -draggingEntered and
-prepareForDragOperation.

Then you retrieve the draggingPasteboard from the object being passed
to either of those methods in sender (a NSDraggingInfo protocol conforming object).

Examine this draggingPasteboard for NSFilenamesPboardType type (using -propertyListForType
if you expect an array or some such other plist representable object, i.e. dictionary).

You usually get an array with one or more elements, each element is a string with the file path
of each file dragged into the NSImageView.


I might have missed a step or two but it should be apparent how everything goes
once you follow these steps. :-)

I hope this helps.

-Esteban
_______________________________________________
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: Newbie: Getting path of file dragged onto NSImageView
  • Next by Date: Re: Newbie: Prompt Before Quitting
  • Previous by thread: Re: Newbie: Getting path of file dragged onto NSImageView
  • Next by thread: Re: What to do to deselect a selected row?
  • Index(es):
    • Date
    • Thread