Hi all, In 10.5, NSTableView handles many keypresses automatically: up arrow, down arrow, page up, page down, home, end, and even 'type select'.
I also need to (robustly!) support the 'delete' key. Overriding deleteBackward: (from NSResponder) doesn't seem to work. For some reason, it is never called. What is the most correct way to support this? I need the keypresses that NSTableView already supports to continue working, and I need to support custom key bindings (meaning the delete functionality may not be mapped to the delete key). My current best is the following, but I don't think it will support custom keybindings. - (void)keyDown:(NSEvent*)event { BOOL deleteKeyEvent = NO; if ([event type] == NSKeyDown) { NSString* pressedChars = [event characters]; if ([pressedChars length] == 1) { unichar pressedUnichar = [pressedChars characterAtIndex:0]; if ( (pressedUnichar == NSDeleteCharacter) || (pressedUnichar == 0xf728) ) { deleteKeyEvent = YES; } } } // If it was a delete key, handle the event specially, otherwise call super. if (deleteKeyEvent) { // This will end up calling deleteBackward: or deleteForward:. [self interpretKeyEvents:[NSArray arrayWithObject:event]]; } else { [super keyDown:event]; } } Thanks for any suggestions, -- ____________________________________________________________ Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]