Re: NSException from [NSTextView setSelectedRange] ?
Re: NSException from [NSTextView setSelectedRange] ?
- Subject: Re: NSException from [NSTextView setSelectedRange] ?
- From: Douglas Davidson <email@hidden>
- Date: Mon, 19 Jun 2006 09:33:35 -0700
On Jun 19, 2006, at 4:20 AM, Theodore H. Smith wrote:
I sometimes get an NSException when calling [NSTextView
setSelectedRange].
My guess is that I'm passing an invalid range.
Can I get NSTextView to correct the range automatically if I pass a
range that extends beyond the bounds of the text? I'd rather have
it auto-correct ranges, than throw NSExceptions. An exception seems
a bit harsh for such a simple mistake :(
An exception is the standard result when an out-of-range argument is
passed in--try it with NSArray, for example. You can easily add a
new method in a category on NSTextView, say -
setSelectedRangeWithTruncation:, that will do what you wish.
Douglas Davidson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden