I have an NSTextView positioned within an NSView. I am
trying to get the mouse coordinates within the
NSTextView. I'm using the following code in the
NSTextView subclass:
NSPoint p = [self convertPoint:[NSEvent
mouseLocation] fromView:[self superview]]; // Get
mouse coordinates within the NSTextView.
I'm getting some really strange coordinates. My goal
is to allow a user to double click an image in the
text view and bring up an image editor. I use the
following code to get the image's coordinates, which
seems to work OK:
[[self layoutManager]
locationForGlyphAtIndex:range.location]
This has been driving me nuts!! Any thoughtful
suggestions would be greatly appreciated. Thank you.