Continuously check in what column is the insertion point.
Continuously check in what column is the insertion point.
- Subject: Continuously check in what column is the insertion point.
- From: Ricardo Diaz <email@hidden>
- Date: Thu, 2 Aug 2007 10:11:46 +0000
- Importance: Normal
Hi, I need to check in what column is the insertion point in an NSTextView. This is what I have so far:
NSRange selectionRange = [textView selectedRange];
unsigned int selection = selectionRange.location;
unsigned int end = [[textView string] lineRangeForRange:selectionRange].location-1;
int currentCol = (selection-end);
[columnField setIntValue:currentCol];
It works perfectly except that when I move the insertion point to the left, for example, nothing happens. This works because the code runs everytime there's a change in the text view.
My only guess is that I need to be notified (NSNotification) when the insertion point is moved or the arrow keys are pressed. Any ideas? I'm also looking for getting the xurrent line the insertion point is in.
Thanks in advanced.
_________________________________________________________________
Make every IM count. Download Windows Live Messenger and join the i’m Initiative now. It’s free.
http://im.live.com/messenger/im/home/?source=TAGWL_June07_______________________________________________
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