Re: Get current caret position
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