escape key?

Member
Posts: 196
Joined: 2002.04
Post: #1
What is the string or whatever for the escape key in Cocoa?

Thanks,
Iceman
Quote this message in a reply
Member
Posts: 196
Joined: 2002.04
Post: #2
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
Quote this message in a reply
Member
Posts: 104
Joined: 2002.04
Post: #3
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
Quote this message in a reply
Member
Posts: 196
Joined: 2002.04
Post: #4
Ahh so thats the difference. Thanks. Grin

Thanks again,
Icy
Quote this message in a reply
Post Reply