Re: "draggedImage" and "draggedImageLocation:"
Re: "draggedImage" and "draggedImageLocation:"
- Subject: Re: "draggedImage" and "draggedImageLocation:"
- From: Graham Cox <email@hidden>
- Date: Mon, 14 Jun 2010 22:52:57 +1000
On 14/06/2010, at 9:50 PM, Chaitanya Pandit wrote:
> I'm observing a very weird behavior with NSDraggingInfo, I have a NSTextView subclass where i have implemented dragging.
> When i drag an image from safari and drop it in the textView and try to access the draggedImage from the supplied <NSDraggingInfo>sender, it returns nil.
> Also, the point that "draggedImageLocation:" method returns when converted to the textView's coordinates, is not exactly where the origin of the dragged image was.
This is normal.
If the image was dragged from outside your app, you can't access the image (remember, the image is just a proxy for some data that is what is really being moved between the apps, so the image itself is of no use to the receiver of the drag, only the data is). The documentation isn't explicit on this point (file bugs) but I took this to be common knowledge, though where it came from I really don't know.
The co-ordinate of draggedImageLocation: is the lower left corner of the image, not the mouse point which is what you might be assuming. Again though, it should not be important to the receiving app - what is important is the -draggingLocation:, i.e. the mouse position.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden