• 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
Getting the current state of the modifier keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting the current state of the modifier keys


  • Subject: Getting the current state of the modifier keys
  • From: Jeffrey Mattox <email@hidden>
  • Date: Sat, 22 Feb 2003 15:07:50 -0600

I have a Cocoa routine that gets a single keystroke or mouse click event. If a modifier key is down, I want to wait until the modifier key is released before proceeding. My routine only gets the one event, not any others. Is there a way to test the current state of the modifiers without getting another event?

I know how to test the event to see if a modifier key was on, but I need to wait for the key(s) to be released.


Background: This will be a workaround for an apparent limitation in AppleScript. My program uses AppleScript and the new Apple System Events (1.2) to issue a "keystroke" command. If I send a keystroke for, say the letter 'a' while the option key is down, System Events actually sends an "option-a". I want to wait for the modifier keys to be released, then I'll send the 'a'. I've found no way in AppleScript to either "undo" the current modifier keys for the keystroke command nor be notified when all modifier keys are released.

Jeff
_______________________________________________
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.

  • Follow-Ups:
    • Re: Getting the current state of the modifier keys
      • From: Greg Titus <email@hidden>
  • Prev by Date: Adding something to the current user's login items.
  • Next by Date: Re: Enumerating Address Book properties
  • Previous by thread: Re: Adding something to the current user's login items.
  • Next by thread: Re: Getting the current state of the modifier keys
  • Index(es):
    • Date
    • Thread