Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

catching modifier keys in a keydown event



Hello all.
I'm having trouble figuring out how to catch modifier keys (command/ option/shift/whatever)
My keydown event is like this:
- (BOOL) onKeyDown: (NSEvent *)theEvent
{
NSString *keyString = [theEvent characters];
unichar key = [keyString characterAtIndex:0];
BOOL keyIsHandled = YES;
OSStatus result = noErr;


	switch (key) {
		case NSUpArrowFunctionKey:
break;
		case NSDownArrowFunctionKey:
	break;
		case NSCarriageReturnCharacter:
		case NSEnterCharacter:
			break;
		case ' ':
			break;
		case 'A':
		break;
		case 'E':
break;

default:
keyIsHandled = NO;
break;
}
NSAssert1 (!result, @"key handled was %d", result);
return keyIsHandled;
}
}
I have no trouble getting regular keypresses, and even the function keys that have values.
But what I can't figure out is how to pickup a key like command-L, or something more complex command-option-L.
I know these keys are returned, and there's four bytes in the key event string, but I have no idea how to interpret these codes.
Do I need another function to handle those keys, or is there some kind of ns values like there is for the arrow keys I can use?
If anyone has some help on this, I'd be forever greatful.


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

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.