Neeru Rana
Neeru Rana

Reputation: 49

How to get Modify shift key in cocoa

How to get the modify Shift key in cocoa. I am making an application and getting the values of all keys using Key code but not able to get the value of (Shift+modify key). Can anybody tell me how i can get this. I have no idea about this. Please provide me help. I am new bie in cocoa.

for all key code in MAC.

Upvotes: 0

Views: 326

Answers (1)

Matthieu Riegler
Matthieu Riegler

Reputation: 54783

See the documention at here. There's a - (NSUInteger)modifierFlags method that returns the modifiers for the event. An you'll find the modifier flags here.

Edit some sample code to get the key :

-(void)keyDown:(NSEvent*)event {
    NSString * character = [event characters];
    unichar keyCode = [character characterAtIndex:0];
    NSLog(@" - Keydown -\n    >>%@<< ->> %c %i<<",character,keyCode, keyCode);
}

Upvotes: 1

Related Questions