• 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: see if a key is down
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: see if a key is down


  • Subject: Re: see if a key is down
  • From: Dietrich Epp <email@hidden>
  • Date: Fri, 4 Oct 2002 22:18:09 -0700

On Monday, September 30, 2002, at 02:55 , Julien Palmas wrote:

i run a timer and each time it fires, i want to see if a key is down, how can i do ?

which key? if it is a modifier key, fire a periodic event once, intercept it, and check the modifier flags.

If you want a different key, use a subclass of NSApplication and override -[sendEvent:], keeping track of which keys are down so this information is available to your timer. You could do this easily enough with an array. Call the event's -[charactersIgnoringModifiers], iterate through characters, and remember that the shift / alpha lock will still capitalize the characters and modifier keys start at 0xf700 (see NSEvent.h). Don't forget that foreign keyboards will send odder characters...

What is the purpose ef this? There might be a much better solution.
_______________________________________________
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.

  • Prev by Date: Fwd: C to Objective-C
  • Next by Date: Re: [Newbie question] Detecting enter pressed on non-editable outlineview?
  • Previous by thread: Re: see if a key is down
  • Next by thread: UML and Cocoa (again...)
  • Index(es):
    • Date
    • Thread