• 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: Get current caret position
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get current caret position


  • Subject: Re: Get current caret position
  • From: Graham Cox <email@hidden>
  • Date: Tue, 16 Nov 2010 23:36:54 +1100

On 16/11/2010, at 11:26 PM, eveningnick eveningnick wrote:

> I a wondering, if it is possible to get the current screen position of
> a text cursor (text caret) using Cocoa? It is possible to do that in
> Windows system (GetCaretPos), maybe Mac allows some similar
> functionality?


The text caret doesn't have a single, global position. It is really the position of the text selection within an active text view when the selection length is zero. If you want to know which logical characters the insertion point is at in a given text view, that's easy to find - just get the selection range and the location field is the position of interest. The text system has methods to convert the logical character position to a view position and from there to a screen position, but why do you want that? In other words, what are you really trying to do?

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Get current caret position
      • From: eveningnick eveningnick <email@hidden>
References: 
 >Get current caret position (From: eveningnick eveningnick <email@hidden>)

  • Prev by Date: Re: valueForKeyPath: not found in protocol
  • Next by Date: Re: Get current caret position
  • Previous by thread: Get current caret position
  • Next by thread: Re: Get current caret position
  • Index(es):
    • Date
    • Thread