Enter key and Return key

miscdas at boxfrog.com miscdas at boxfrog.com
Thu Apr 10 05:55:01 EDT 2003


Shari writes: 

> I received a feature request for my Blackjack Gold game, as follows: 
> 
> However, I would like to be able to use the "enter" key after placing a 
> bet with the shortcut "command" + "b". I have to use the return key. 
> 
> Since I enter my bets with the keypad, the "enter" key is faster and more 
> convenient than using the "return" key. Thanks! -- 
> 
> --- 
> 
> He is referring to an Ask dialog, nothing fancy, nothing special made.
> The script takes the contents of "it" and does it's thing. 
> 
> --- 
> 
> My keyboard has an Enter and Return key, and both work as he wishes. Why 
> would his work differently? 
> 
> I've put an "enterKey" and "returnKey" handler in the "ask" stack, but why 
> would this even be necessary? 
> 
> Shari C
================== 

In simple terms, every key on the keyboard is mapped to a number. Each 
number has an action mapped to it, so it appears in the end as though each 
key has an action mapped to it. To get different actions for the same key, 
the mapping table is revised (this is how a QWERTY layout is changed to a 
more efficient layout). The numeric keypad "numeral" actions are usually 
mapped to the same actions as the "numeral" keys across the top of the 
keyboard, resultng in display of the same numeral by pressing either set of 
keys. However, if you examine the key value, you'll find that indeed they 
are diferent. Both values are mapped to the same action--display of the 
specific numeral. 

For the key mappings in this case, it appears both Return and Enter are 
mapped to exactly the same action on your computer, while your user's are 
not, hence the difference in behavior. You must test for both keyvalues, as 
you stated that you have now done by including both handlers. 

miscdas 




More information about the metacard mailing list