• 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
Continuously check in what column is the insertion point.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Thread Communication Conceptual Question
  • Next by Date: Re: Using -interpretKeyEvents in NSTextView to interpret key events
  • Previous by thread: Re: Insert at cursor position NSTokenField
  • Next by thread: Re: Using -interpretKeyEvents in NSTextView to interpret key events
  • Index(es):
    • Date
    • Thread