Reputation:
I recognize which key user enter in textfield with below code.but i can't recognize keys like 'Caps lock' - 'shift' - 'control' - 'command' - 'option' - 'tab' how can i recognize them ?
- (void)keyUp:(NSEvent *)theEvent
{
unichar keyChar = 0;
keyChar = [theArrow characterAtIndex:0];
NSString *aci=[NSString stringWithFormat:@"%d",keyChar];
}
Upvotes: 1
Views: 240
Reputation: 90521
Those are modifier keys and they don't generate NSKeyDown
and NSKeyUp
events. They generate NSFlagsChanged
events. The corresponding NSResponder
method is -flagsChanged:
.
Upvotes: 1