[Gambas-user] German keyboard - AltGr triggers Right [solved]
Eilert
eilert-sprachen at ...221...
Tue Nov 21 08:19:15 CET 2006
Eilert schrieb:
> Hi,
>
> I'm trying around with _KeyPress in the current Gambas 1.0.
>
> I've got
>
>
>
> PUBLIC SUB Seite_KeyPress()
>
> IF key.Shift THEN
>
> ELSE IF key.Control THEN
>
> ELSE IF key.Alt THEN
>
> ELSE IF key.Meta THEN
>
> ELSE IF key.Normal THEN
> CursorAus
> SELECT CASE key.Code
> CASE key.Right
> IF cS < String.Len(txt[cZ]) + 1 THEN INC cS
>
> CASE key.Left
> IF cS > 1 THEN DEC cS
>
>
> and so on...
>
> Now, when I want to enter a { or a Euro-Sign or anything connected with
> the AltGr key on the German keyboard (is it Ctrl-Shift or Ctrl-Alt or
> what?), KeyPress delivers a key.Right once, then waits until the sign is
> pressed and delivers the sign then.
>
> How can I avoid the key.Right?
>
> Thanks for all ideas and have a nice weekend!
>
I solved the thing, and it turned out not to be the Right-key. The trick
is to avoid an empty key.Text before processing text input. Otherwise,
pressing any Shift, Control, Alt or whatever will try to insert text:
PUBLIC SUB Seite_KeyPress()
IF key.Control THEN
ELSE IF key.Alt THEN
ELSE
CursorAus
SELECT CASE key.Code
CASE key.Right
IF cS < String.Len(txt[cZ]) + 1 THEN INC cS
CASE key.Left
IF cS > 1 THEN DEC cS
CASE ELSE
IF key.Text <> "" THEN
'now it's safe to insert text here!
END IF
Maybe we should add such an example to the wiki?
Regards
Rolf
More information about the User
mailing list