• 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
Getting updated insertion point from NSDraggingInfo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Getting updated insertion point from NSDraggingInfo
      • From: Douglas Davidson <email@hidden>
    • Re: Getting updated insertion point from NSDraggingInfo
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: NSImage allocation issues
  • Next by Date: Re: NSImage allocation issues
  • Previous by thread: SIGPIPE with dataWithPDFInsideRect
  • Next by thread: Re: Getting updated insertion point from NSDraggingInfo
  • Index(es):
    • Date
    • Thread