Re: Detect shift key down
Re: Detect shift key down
- Subject: Re: Detect shift key down
- From: Bernard Desgraupes <email@hidden>
- Date: Sun, 26 Jun 2011 08:59:32 +0200
Le 26 juin 11 à 07:22, Richard Somers a écrit :
On Jun 24, 2011, at 1:19 AM, Bernard Desgraupes wrote:
I need to detect if the shift key is pressed by the user during the
startup of my app. How would I do that in Cocoa (targetting 10.5
and greater) ?
Try this.
http://www.cocoabuilder.com/archive/cocoa/284356-alternative-startup-for-application.html
Thank you, this link is very helpful. The CGEventSourceKeyState
solution works perfectly.
Le 26 juin 11 à 07:18, Ken Heglund a écrit :
This is how I do it in the application delegate's
applicationDidFinishLaunching: implementation...
UInt32 modifiers = GetCurrentKeyModifiers();
if ( modifiers & shiftKey ) {
// handle shift key...
}
Thank you for the suggestion. In fact I'm entirely rewriting my Carbon
app from scratch using Cocoa: GetCurrentKeyModifiers() is what I was
doing previously. I was looking for a Cocoa solution.
Thanks to everybody,
cheers,
Bernard_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden