Re: Cursor position
Re: Cursor position
- Subject: Re: Cursor position
- From: Timothy Ritchey <email@hidden>
- Date: Mon, 27 Jan 2003 12:03:38 -0500
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@hidden
>
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@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.