• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: location of text in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >location of text in NSTextView (From: Nik Youdale <email@hidden>)

  • Prev by Date: Re: location of text in NSTextView
  • Next by Date: Re: location of text in NSTextView
  • Previous by thread: Re: location of text in NSTextView
  • Next by thread: Re: location of text in NSTextView
  • Index(es):
    • Date
    • Thread