Skip navigation.
 
mlRe: Cursor position
FROM : Timothy Ritchey
DATE : Mon Jan 27 18:03:38 2003

try the delegate method:

- (NSRange)textView:(NSTextView *)aTextView
willChangeSelectionFromCharacterRange:(NSRange)oldSelectedCharRange
toCharacterRange:(NSRange)newSelectedCharRange


You will end up with a newSelectedCharRange.location where the cursor
is located, with a newSelectedCharRange.length == 0.

On Monday, January 27, 2003, at 11:37  AM, Chaffinch wrote:

> Hi,
>
> I have a NSTextView contained within an NSScrollView and I want to
> know the
> current row and column of the cursor. There is a delegate method
> controlTextDidChange (or something like that) which get called for
> every
> character key pressed, I can calculate the row and column in the text
> view
> here.
>
> But when the cursor is positioned with the mouse or arrow keys this
> method is
> not called. doCommandBySelector may help me with the arrow keys, but I
> still
> have the mouse positioning to worry about.
>
> Alternatively, is there some other way I can get the coordinate of the
> cursor
> within the NSWindow, and translate that to a row and column somehow????
>
> Thanks
>
>
> =====
> Regards
>
> Chaffinch
> ----------------------------------------------
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> _______________________________________________
> cocoa-dev mailing list | <email_removed>
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.

_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlCursor position Chaffinch Jan 27, 17:37
mlRe: Cursor position Timothy Ritchey Jan 27, 18:03