user437064
user437064

Reputation:

Recognize that which key user enter in a textfield

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

Answers (1)

Ken Thomases
Ken Thomases

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

Related Questions