• 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: Shift key state on mouse motion or drag etc..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shift key state on mouse motion or drag etc..


  • Subject: Re: Shift key state on mouse motion or drag etc..
  • From: Scott Harper <email@hidden>
  • Date: Tue, 4 Oct 2005 02:32:00 -0600

I also have this functionality that I am seeking -- on my mouseDown method in my custom NSView subclass, I have this code:


BOOL modPressed = [event modifierFlags] & NSShiftKeyMask; NSLog(@"MouseDown -- Shift pressed: %i", modPressed);

This code, however yields the logged line...

2005-10-04 02:17:55.541 Marquer[4441] MouseDown -- Shift pressed: 0

...regardelss of whether or not I am actually PRESSING the shift key. Any ideas?

--Scott

Nevermind -- I fixed it with using int to find the real value. Apparently (and in hindsight obviously) if the even mask CONTAINS the shift mask, then the value will not be a boolean, but rather the shift mask itself. Thus, I assume that for my purposes, I should put something like this instead:


BOOL modPressed;
if([event modifierFlags] & NSShiftKeyMask)
    modPressed = YES;
else modPressed = NO;

Heh.  Sorry about the self-answered post.

--Scott
_______________________________________________
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: 
 >Re: Shift key state on mouse motion or drag etc.. (From: Scott Harper <email@hidden>)

  • Prev by Date: Re: Shift key state on mouse motion or drag etc..
  • Next by Date: Re: facing pages in a pdfview?
  • Previous by thread: Re: Shift key state on mouse motion or drag etc..
  • Next by thread: Getting an NSLocalizedString for another localization
  • Index(es):
    • Date
    • Thread