Location on screen of location in NSTextView?

According to the documentation the location for a glyph is relative to its enclosing line fragment. You should adjust the point by using the rectangle of the line fragment. That should fix the variation you see.

Up vote 2 down vote favorite 1 share g+ share fb share tw.

I want to get the screen location (NSPoint) of a point in an NSTextView, this should be simple, but by results are always a bit off, the X is perfect, but the Y seems to vary. I've tried a few variations of the code below, but can't get the result I'm after, is the NSClipView screwing it up? NSPoint p = self layoutManager locationForGlyphAtIndex:r.

Location; //NSPoint b= self convertPoint:p toView:nil; NSPoint screenlocation = self convertPointToBase:p; Any ideas? Cheers! MT cocoa layout nstextview glyph link|improve this question edited Feb 11 '10 at 16:53Laurent Etiemble11.8k2929 asked Feb 11 '10 at 10:51MT.675 30% accept rate.

According to the documentation, the location for a glyph is relative to its enclosing line fragment. You should adjust the point by using the rectangle of the line fragment. That should fix the variation you see.

Perfect! Thanks a lot! – MT.

Feb 12 '10 at 11:39.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions