Simple CarbonEvent Question

Post: #1
Quote:case kEventRawKeyDown:
GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, nil,
sizeof(charCode), nil, &charCode);
gKeyState[charCode] = true;

Sorry if im missing a really really easy answer but how do I tell if the return and enter keys have been pressed? I tried checking for "\n" and "\r"

Quote this message in a reply
Posts: 613
Joined: 2004.09
Post: #2

#define returnKey 0x0D

if(charcode == returnKey)

Kyle Richter
Twitter: @kylerichter
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #3
uh, 0x0D is '\r'...
Quote this message in a reply
Posts: 14
Joined: 2004.07
Post: #4
From events.h

kEnterCharCode = 3,
kReturnCharCode = 13,

and so...

char theChar;
GetEventParameter (event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &theChar);

if (theChar == (char)kReturnCharCode || theChar == (char)kEnterCharCode)

Take aquadot!red out for a spin
It sure ain't your grandpa's pacman!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  simple question (private) imaumac 9 6,867 Oct 21, 2008 09:37 PM
Last Post: imaumac
  simple Question about movement bonanza 3 4,795 Oct 17, 2007 11:12 AM
Last Post: bonanza
  Really simple #pragma question WhatMeWorry 9 7,679 Dec 13, 2006 10:15 PM
Last Post: Nick
  Simple OpenGL/Xcode Question. loopfick 10 10,360 Sep 8, 2005 09:54 AM
Last Post: Volte
  Simple Animation Question KiroNeem 11 8,865 Nov 20, 2004 09:17 AM
Last Post: DoG