• 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: How to handle non-character keyboard events?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to handle non-character keyboard events?


  • Subject: Re: How to handle non-character keyboard events?
  • From: Alexandre Aybes <email@hidden>
  • Date: Fri, 7 Dec 2001 17:10:52 +0100

This is what I am using (taken pretty much straight out of the OmniGroup Game examples):
- (void)keyDown:(NSEvent *)theEvent
{
NSString *characters;
unichar c;
unsigned int characterIndex, characterCount;

// There could be multiple characters in the event.
characters = [theEvent charactersIgnoringModifiers];

characterCount = [characters length];
for (characterIndex = 0; characterIndex < characterCount; characterIndex++)
{
c = [characters characterAtIndex: characterIndex];
switch(c)
{
case NSUpArrowFunctionKey:
if (isRunning)
[camera moveByDistance:keyboardSpeed*2.0];
else
[camera moveByDistance:keyboardSpeed];
break;
// [snip]...
}
}
}

Hope this helps,
Alex.


  • Follow-Ups:
    • Re: How to handle non-character keyboard events?
      • From: André Benassi <email@hidden>
References: 
 >How to handle non-character keyboard events? (From: André Benassi <email@hidden>)

  • Prev by Date: How to handle non-character keyboard events?
  • Next by Date: Re: How to handle non-character keyboard events?
  • Previous by thread: How to handle non-character keyboard events?
  • Next by thread: Re: How to handle non-character keyboard events?
  • Index(es):
    • Date
    • Thread