Hi everyone... over the University summer holiday, I've decided to learn Objective-C and Cocoa, after initially messing about with it from some articles on macdevcenter.com.
I'm running OS X 10.2 with the version of the dev tools that came with it.
I ordered Learning Cocoa with Objective-C (2nd Edition) and Building Cocoa Applications as they were reasonably priced when bought together from Amazon.
I got through the Learning Cocoa book in a few days, and had no trouble understanding it or doing any of the examples. However, I'm having some trouble with some of the code in the MathPaper section of Building Cocoa.
I can't figure out why the following code isn't working:
- (void)textDidChange

NSNotification *)notification
{
NSString * key = [[[self window] currentEvent] characters];
// if key is equal to carriage return
if ( [key isEqualToString:@"\r"] ) { ...
Enter never seems to equal \r or \n, and I can't figure out why.. the page the code is on is 338. Using NSLog shows that it is getting the last character properly.
Can anybody help me get this working, or explain why the current code doesn't work?
edit: it's in the delegate class for an NSTextView, which is a subclass of NSWindowController.