• 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: Detecting Keydowns
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting Keydowns


  • Subject: Re: Detecting Keydowns
  • From: Eric Peyton <email@hidden>
  • Date: Tue, 12 Jun 2001 08:58:08 -0500

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.

Eric

On Monday, June 11, 2001, at 11:15 PM, Steve Gehrman wrote:

How can I tell if the user is holding down a key on the keyboard (ie cmd period to stop a loop.)

steve
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: Detecting Keydowns
      • From: Stéphane Sudre <email@hidden>
References: 
 >Detecting Keydowns (From: Steve Gehrman <email@hidden>)

  • Prev by Date: Cocoa/EOF for non-enterprise apps Re: proof of cocoa superiority?
  • Next by Date: Re: Stderr from AuthorizationExecuteWithPrivileges
  • Previous by thread: Detecting Keydowns
  • Next by thread: Re: Detecting Keydowns
  • Index(es):
    • Date
    • Thread