[Gambas-user] Key code constant wrong?

Alain Baudrez a.baudrez at ...626...
Sun Nov 10 06:05:25 CET 2013


2013/11/9 MinnesotaJon <nicholso at ...2533...>

> ......
> 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
>
>
>
Hoi,

txs for the info.

Why is Enter printed on that key on my laptop ??

I would never have guessed to refer to Key.Return instead of key.Enter.

Alain



More information about the User mailing list