I got a subclass of NSWindow in an NSDocument application to receive keyDown events.
I used the following code in my subclasses ...
- (void)keyDown:(NSEvent *)theEvent {
NSLog(@"keyDown!");
if ([theEvent modifierFlags] & NSAlternateKeyMask) {
NSLog(@"Alt key Down!");
}
else
[super keyDown:theEvent];
}
I get key events when keys are pressed without a modifier! I also get "Alt Key Down" when I press alt + z, for example (alt + non-modifierkey).
The problem is that I want to handle the event when only one alt / option key is pressed one, without a combination with other keys and -keyDown: is not called! What am I missing?
Thank...
source
share