Re: location of text in NSTextView
Re: location of text in NSTextView
- Subject: Re: location of text in NSTextView
- From: "Adam R. Maxwell" <email@hidden>
- Date: Sat, 21 Jan 2006 19:01:46 -0800
On Jan 21, 2006, at 18:40, Nik Youdale wrote:
Hi,
Is there any way to get the location (either an NSRect or an
NSPoint) of text within a specified range in an NSTextView?
Use -[NSLayoutManager
glyphRangeForCharacterRange:actualCharacterRange:] to get the glyph
range, then -[NSLayoutManager
lineFragmentRectForGlyphAtIndex:effectiveRange:] to get the line
rect; if you need the point of a specific glyph, you can use -
[NSLayoutManager locationForGlyphAtIndex:]. These are all in text
container coordinates, IIRC (I did this a couple weeks ago based on
hints in the cocoabuilder archives).
hth,
Adam
_______________________________________________
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