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 (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com