Getting updated insertion point from NSDraggingInfo
Getting updated insertion point from NSDraggingInfo
- Subject: Getting updated insertion point from NSDraggingInfo
- From: Jeremy Dronfield <email@hidden>
- Date: Fri, 30 Apr 2004 14:59:06 +0100
Is it possible to get the updated insertion point in a text view from
NSDraggingInfo? I'm handling drag-n-drop in my text view subclass in
order to overcome the limitations of the default handling of dropped
images. In doing so, I've lost the default behaviour whereby the
dropped image is inserted at the drag location. Instead, the image
drops in at the insertion point set prior to the drag operation
starting. As the mouse moves around in the view, the visible insertion
point moves with it, but there seems to be no way of grabbing that
point and making it the drop location.
I've tried overriding -draggingUpdated:, but can't figure out a way to
get the updated insertion point from the NSDraggingInfo passed into the
method. -draggingLocation seems to be no use, since it returns an
NSPoint in the window's coordinate system.
How does NSTextView's implementation ensure that the dropped item goes
to the right place? I tried the following, but it was useless:
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
int currentLocation = [super selectedRange].location;
[self setSelectedRange:NSMakeRange(currentLocation, 0)];
return [super draggingUpdated:sender];
}
Regards,
-Jeremy
_______________________________________________
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.