I'm using the following code to detect the return key in a text view. How do you detect if the shift key is being pressed too?
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
{
if(commandSelector == @selector(insertNewline:))
{
// return key
return YES;
}
return NO;
}
subclass NSTextView and override flagsChanged with this
-(void) flagsChanged:(NSEvent *)theEvent {
if ([theEvent modifierFlags] & NSShiftKeyMask && [theEvent modifierFlags] & NSCommandKeyMask) {
NSLog(@"pressed");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With