[Gambas-user] Key code constant wrong?

MinnesotaJon nicholso at ...2533...
Sat Nov 9 22:07:25 CET 2013


......
Wamukota wrote
> The value for the key.enter constant in the 3.5.0 on my box is given as
> 16777221
> 
> ? key.enter
> 16777221
> 
> But, the value returned by key.code in the program is 16777220 in the
> keyrelease or the keypress events which implies that I cannot check if the
> key pressed is the Enter/Return key using the constants.
> As a workaround I switched to checking for the number or the key.enter
> value as valid values,  but I know that is not the way to go....
> 
> Bug?

Alain --

The Enter key and the Return key are actually 2 different keys!

In my blog post
"http://beginnersguidetogambas.com/2013/02/12/some-useful-gambas-usages-and-examples/",
I explain:

Note that the “Return” key is the “enter” key near the center of a standard
desktop PC keyboard, with the “return” symbol.
The “Enter” key is the “enter” key at the right side of a standard desktop
PC keyboard, with the numeric keypad.

The keys are equivalent in function, but each one returns a different key
code.  Here is how you use the constants:

.....
    If Key.Code = Key.Return Or Key.Code = Key.Enter Then
        ......
    Endif




--
View this message in context: http://gambas.8142.n7.nabble.com/Key-code-constant-wrong-tp44176p44183.html
Sent from the gambas-user mailing list archive at Nabble.com.




More information about the User mailing list