trouble with NSRange.location
trouble with NSRange.location
- Subject: trouble with NSRange.location
- From: Robert Burns <email@hidden>
- Date: Thu, 18 Dec 2003 11:29:18 -0600
Sorry that last code was a bit mangled by my various attempts to pin
down the problem. Here's a clearer version of the code that's produces
the same problem:
#import "LLTempoController.h"
@implementation LLTempoController
- (void)textDidChange:(NSNotification *)notification;
{
theText = [[notification object] textStorage];
rangeForInsertion = [theText editedRange];
unsigned int insertionIndex = rangeForInsertion.location; // it's
always 2147483647;
unsigned int insertionLength = rangeForInsertion.length;
NSLog(@"insertionIndex in first routine is %d", insertionIndex);
NSLog(@"insertionLength in first routine is %d", insertionLength);
}
@end
Greetings!
new to the list and fairly new to cocoa.
I've searched the archives and much documentation and can't understand
what's going wrong with my use of an NSTextStorage editedRange.
Whenever I get the editedRange.location (and I've tried this many
different ways) I always get the integer 2147483647 instead of
something within the length of the text. If I get the
editedRange.length it gives me exactly what I expect (i.e., 1 if no
text is selected, 0 if it's a backspace delete, and n when selected
text is changedf n characters in length). So does anyone know what I'm
missing here?
This class is serving as a delegate to an NSTextView, established in
IB.
Thanks,
Rob Burns
ps, code follows:
#import "LLTempoController.h"
@implementation LLTempoController
- (void)textDidChange:(NSNotification *)notification;
{
NSLog(@"retainCount of notification is %d", [notification
retainCount]);
theText = [[notification object] textStorage];
unsigned int insertionIndex = [theText editedRange].location; //
it's always 2147483647;
unsigned int insertionLength = rangeForInsertion.length;
NSLog(@"insertionIndex in first routine is %d", insertionIndex);
NSLog(@"insertionLength in first routine is %d", insertionLength);
}
@end
_______________________________________________
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.