Converting point struct from superview to subview
Converting point struct from superview to subview
- Subject: Converting point struct from superview to subview
- From: Ian was here <email@hidden>
- Date: Fri, 24 Jun 2005 08:37:06 -0700 (PDT)
Hi All,
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.
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden