• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting the current state of the modifier keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the current state of the modifier keys


  • Subject: Re: Getting the current state of the modifier keys
  • From: Eric Schlegel <email@hidden>
  • Date: Sat, 22 Feb 2003 22:45:08 -0800

On Saturday, February 22, 2003, at 04:33 PM, Jeffrey Mattox wrote:

But, if I'm not the active application, then the flags returned are wrong.

Note this comment in CarbonEventsCore.h:

/*
* GetCurrentEventKeyModifiers()
*
* Note that GetCurrentEventKeyModifiers only returns a valid
* modifier state if your application is the active application. If
* your application is not active, then user input events are not
* flowing through the event dispatcher and the queue-synchronized
* state is not updated.

Is there a reliable way to get the current state of the modifier keys, even when I'm not active?

GetCurrentKeyModifiers in HIToolbox/Events.h will return the current hardware state of the key modifiers. I seem to recall that you originally said something about posting an option key press using SystemEvents, though; I'm not sure if GetCurrentKeyModifiers will work in that case, when you're creating a "software key press" rather than affecting the actual hardware state. You'll have to try and see.

-eric
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Getting the current state of the modifier keys (From: Jeffrey Mattox <email@hidden>)

  • Prev by Date: Re: Getting the current state of the modifier keys
  • Next by Date: vtables in objc++
  • Previous by thread: Re: Getting the current state of the modifier keys
  • Next by thread: Re: Getting the current state of the modifier keys
  • Index(es):
    • Date
    • Thread