Re: Detecting Keydowns
Re: Detecting Keydowns
- Subject: Re: Detecting Keydowns
- From: Stéphane Sudre <email@hidden>
- Date: Wed, 13 Jun 2001 19:27:38 +0200
On mardi, juin 12, 2001, at 03:58 PM, Eric Peyton wrote:
If you are in a hard loop (i.e. you aren't using timers to fire the
next iteration, you are in a while (1), etc.) you can usually use the
nextEvent (nextEventMatchingMask:) methods on NSApplication to get and
deploy (postEvent: or sendEvent:) the next event on the stack. Then
you can just register your view to accept key down events and when you
get a keyDown: check the event's modifier flags to see if Cmd is being
pressed and if the key down character was '.'.
Read up on NSApplication and NSEvent.
I can give you a better example if you need code, but this is the
method I have used in the past.
What if you just want to detect if the option, control keys are down at
one moment ?
I believe it's possible to get this information using Carbon and the
GetKeys stuff. But is there a Cocoa way to do that ?