• 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
Re: catching command-enter keyDown events in a table view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: catching command-enter keyDown events in a table view


  • Subject: Re: catching command-enter keyDown events in a table view
  • From: Todd Ransom <email@hidden>
  • Date: Thu, 4 Nov 2004 08:46:48 -0700

This little snippet catches Option-Enter and adds a new row to the the tableView. The NSEvent contains the information about modifier keys.

- (void)keyDown:(NSEvent *)event {

unsigned short keyPress = [event keyCode];
unsigned int flags = [event modifierFlags];


// NSLog (@"%hu", keyPress);
#pragma mark Option keyPresses


if (flags & NSAlternateKeyMask) {
if (keyPress == 76 || keyPress == 36) { // option + return or enter
[self addNewRow:self];
}
}
On Nov 4, 2004, at 5:23 AM, Salánki Benjámin wrote:

Hi all,

I got stuck while I was trying to catch command-enter keyDown events in my NSTableView.
I subclassed NSTableView and added keyDown: and insertNewLine: and i can now successfully work with my code after an enter was pressed on my tableview, but how can I check if the command (apple) or any other modifier key for that matter was pressed at the same time?

Thanks,

Ben

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: catching command-enter keyDown events in a table view
      • From: August Trometer <email@hidden>
References: 
 >catching command-enter keyDown events in a table view (From: Salánki Benjámin <email@hidden>)

  • Prev by Date: Re: NSSplitView replacement
  • Next by Date: Scrolling of multiple NSTableViews
  • Previous by thread: catching command-enter keyDown events in a table view
  • Next by thread: Re: catching command-enter keyDown events in a table view
  • Index(es):
    • Date
    • Thread