• 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
Re: textViewDidChangeSelection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: textViewDidChangeSelection


  • Subject: Re: textViewDidChangeSelection
  • From: John Anderson <email@hidden>
  • Date: Wed, 19 Jun 2002 10:41:50 -0700

The result of selectedRange is an NSRange, which is a struct. It contains two elements, a location and a length. So you can get the length of the selection like this: [myTextView selectedRange].length

This will return an integer.

John Anderson


On Wednesday, June 19, 2002, at 10:28 AM, Jeremy Dronfield wrote:

I've got the following method which enables a button when text in a TextView is selected:

- (void)textViewDidChangeSelection:(NSNotification *)aNotification
{
[[self markButton] setEnabled:YES];
}

It works, but I really want to know how to make it conditional, so that if the text is deselected, markButton is disabled again. I've messed about with various if's using selectedRange, but can't get anything to work. The problem seems to be that I don't know how to access selectedRange's length.

- Jeremy
_______________________________________________
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.

References: 
 >textViewDidChangeSelection (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: toolbar in a sheet drawing issues
  • Next by Date: Re: Extra Menu
  • Previous by thread: textViewDidChangeSelection
  • Next by thread: again : sending e-mails by program
  • Index(es):
    • Date
    • Thread