• 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: André Benassi <email@hidden>
  • Date: Fri, 7 Dec 2001 10:30:27 -0600

Sweet! Thanks for mentioning the OmniGroup Game examples, it is a resource that I did not know existed. It should be very helpful for me and my friends. We are working together trying to learn Cocoa and create a game at the same time. Thanks!

Andri

On Friday, December 7, 2001, at 10:10 AM, Alexandre Aybes wrote:

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.


References: 
 >Re: How to handle non-character keyboard events? (From: Alexandre Aybes <email@hidden>)

  • Prev by Date: Re: is [uiObject display] necessary?
  • Next by Date: monitoring file modifications
  • Previous by thread: Re: How to handle non-character keyboard events?
  • Next by thread: Re: How to handle non-character keyboard events?
  • Index(es):
    • Date
    • Thread