PDA

View Full Version : escape key?


Iceman
2002.08.16, 12:01 PM
What is the string or whatever for the escape key in Cocoa?

Thanks,
Iceman

Iceman
2002.08.16, 12:06 PM
Ok I just got it working by using:
if ([keyChars characterAtIndex:index] == 27) { }

why wouldn't the code I used before work?:
if ([keyChars isEqualToString:@"27"]) {}

Thanks,
Iceman

GoodDoug
2002.08.16, 02:25 PM
Because "27" is a string containing the 2 character, the 7 character and a null character. 27 (without the quotes) is the number 27. So, in the incorreect version, you are testing whether the user had pressed 2 and 7 at about the same time (with the 2 first)

Hoope this helps

Iceman
2002.08.16, 08:48 PM
Ahh so thats the difference. Thanks. :D

Thanks again,
Icy