• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: detect command key status
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >detect command key status (From: Richard Salvatierra <email@hidden>)
 >Re: detect command key status (From: Richard Salvatierra <email@hidden>)

  • Prev by Date: Non-activating panel problem
  • Next by Date: Re: Simple drag problem
  • Previous by thread: Re: detect command key status
  • Next by thread: Re: detect command key status
  • Index(es):
    • Date
    • Thread