Re: Getting updated insertion point from NSDraggingInfo
Re: Getting updated insertion point from NSDraggingInfo
- Subject: Re: Getting updated insertion point from NSDraggingInfo
- From: Douglas Davidson <email@hidden>
- Date: Fri, 30 Apr 2004 09:57:06 -0700
On Apr 30, 2004, at 6:59 AM, Jeremy Dronfield wrote:
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.
What the text view does is to take that point in the window's
coordinate system, convert it into the view's coordinate system, then
into the container's coordinate system, and get a glyph index for that
point; then it converts this to a character index, and sets the
selected range accordingly. We don't have all of this packaged up for
you in a single method--perhaps we should--but it can be done using
public API. (Note that we also look at the fractional distance through
the glyph, and if it's greater than 0.5, we round up.)
Douglas Davidson
_______________________________________________
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.