performKeyEquivalent disables Command-Q hotkey
performKeyEquivalent disables Command-Q hotkey
- Subject: performKeyEquivalent disables Command-Q hotkey
- From: Michael Becker <email@hidden>
- Date: Wed, 14 Jul 2004 17:26:39 +0200
Sorry for the (no subject) before...
Am Jul 14, 2004 um 2:32 PM schrieb Michael Becker:
Hello!
I have a question concerning NSView's performKeyEquivalent:.
In my NSView subclass, I implement performKeyEquivalent in order to
react to the user pressing certain keys. However, this seems to kill
the standard Command-Q (Quit application) functionality. I tried
invoking [ super performKeyEquivalent:] before doing my own stuff, but
that didn't work either. Here's my bit of code:
- (BOOL)performKeyEquivalent:(NSEvent*)event {
if ([ super performKeyEquivalent:event]) {
return YES;
} else {
unichar theChar = [[ event charactersIgnoringModifiers]
characterAtIndex:0];
// Select all images on COMMAND-A
if (( theChar == 'a' ) && ( [ event modifierFlags] &
NSCommandKeyMask )) {
[ self selectAllImages];
[ self setNeedsDisplay:YES];
return YES;
}
}
return NO;
}
(This was copy-pasted to Mail.app and then manually modified a little,
so I might have put some syntax errors to it :-))
What can I do?
Regards,
Michael
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >(no subject) (From: Michael Becker <email@hidden>) |