Re: Shift key state on mouse motion or drag etc..
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