One Quickie


Reacting to the Escape key (NSView->General)
There's no predefined constant for the Escape key. Luckily the escape key predates every personal computer, and so it has a pretty reliable character value that's generated: 27:
- (void) keyDown: (NSEvent *) event
{
    NSString *chars = [event characters];
    unichar character = [chars characterAtIndex: 0];

    if (character == 27) {
        NSLog (@"ESCAPE!");
    }
} // keyDown



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com