Right arrow keypress == enter keypress in NSTableView subclass?
Right arrow keypress == enter keypress in NSTableView subclass?
- Subject: Right arrow keypress == enter keypress in NSTableView subclass?
- From: "John C. Warner" <email@hidden>
- Date: Wed, 28 Jul 2004 11:46:23 -0400
I have a NSTableView subclass in my app that implements a little
favorites list for users to keep often-used files in. I have keyboard
navigation working - up/down arrow, and return/enter to open the file,
but pressing the right arrow key also launches the file. This isn't
unwelcome behaviour - it was the next thing on my to do list - but I'd
like to know why it's happening, and if I should rely on it. Is this
just the way NSTableView works?
Here's my view's keyDown method:
-(void)keyDown:(NSEvent *)theEvent
{
char keyChar = [[theEvent characters] characterAtIndex:0];
if (keyChar == NSEnterCharacter || keyChar ==
NSCarriageReturnCharacter)
{
[[self dataSource] openBookmark:self];
}
else
{
[super keyDown:theEvent];
}
}
Thanks,
-John
_______________________________________________
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.