Re: detect command key status
Re: detect command key status
- Subject: Re: detect command key status
- From: glenn andreas <email@hidden>
- Date: Mon, 27 Jun 2005 10:23:30 -0500
On Jun 27, 2005, at 10:07 AM, Richard Salvatierra wrote:
Thanks for your suggestions. Not sure why the NSCommandKeyMask
does not cover my command keys though.
I have to check for other modifierflags.
- (void) flagsChanged:(NSEvent *)theEvent {
int modifierflag = [theEvent modifierflag];
if( modifierflag == NSCommandKeyMask || modifierflag == 1048840
|| modifierflag == 1048584 || modifierflag == 1048848) {
commandKeyDown = YES;
}else if(modifierflag == 256){
commandKeyDown = NO;
}
}
Why not just check the specific bit instead of all possible
variations of other modifier keys? Since modifier flag contains the
state of _all_ modifiers (not just the command key) you really only
want to look at the one bit...
commandKeyDown = (modifierFlag & NSCommandKeyMask) ==
NSCommandKeyMask;
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden