• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Right arrow keypress == enter keypress in NSTableView subclass?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Right arrow keypress == enter keypress in NSTableView subclass?
      • From: Clark Cox <email@hidden>
    • Re: Right arrow keypress == enter keypress in NSTableView subclass?
      • From: Allan Odgaard <email@hidden>
  • Prev by Date: Re: What happened to my logging output ?!
  • Next by Date: Re: Noddy array controller / bindings question
  • Previous by thread: Re: Binding window title
  • Next by thread: Re: Right arrow keypress == enter keypress in NSTableView subclass?
  • Index(es):
    • Date
    • Thread