Re: examining keyboard state ?
Re: examining keyboard state ?
- Subject: Re: examining keyboard state ?
- From: Dan Wood <email@hidden>
- Date: Tue, 25 Sep 2001 15:00:51 -0700
You say you're not "using" NSEvent but it sounds like you need to,
if you're responding to an action. Ge the current event, and then
get the modifier flags. For example, this determines if the option
key was down at the event:
NSEvent *event = [NSApp currentEvent];
int modifierFlags = [event modifierFlags];
BOOL optionDown = (0 != (modifierFlags & NSAlternateKeyMask) );
There may be other ways for asking "is the option key currently
held down", not associated with an event, but I haven't explored
that yet.
On Tuesday, September 25, 2001, at 12:41 PM, Robert Miller wrote:
Hello,
Another basic question ? How does one go about grabbing the
keyboard
state (the Carbon call GetKeys(...) equivalent) in Cocoa ? I want to be
able to grab the keyboard state at the time I receive a particular
IBAction call from a button click in my window. I can't seem to find
anything on this subject except for the NSEvent stuff which I am not
using in this case. I'm looking to check if things like the option key,
command key, etc. are pressed at the time I service the mouse click in
the IBAction method, or at any time for that matter? Anybody ???
Thanks in advance.
Regards,
Bob M.
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
--
Dan Wood
email@hidden
http://www.karelia.com/
http://www.bikealameda.org/
Mac OS X Developer: Online Resume:
http://www.karelia.com/resume.html
"We have met the enemy and he is us" -- Walter Kelly (Pogo),
perhaps predicting the World Trade Center tragedy and America's
foreign policies and our sorry excuse for airline security...