Where do you expect "nKeyCode" to "go" ?
It doesn't "go" anywhere; it's just a parameter into .KeyPress.
You can use KEYBOARD, which will then just loop your character back to .KeyPress.
You would then need to toggle some flag that would indicate that this is a translated character and no further action is required.
If you want this "translation" to go into some TextBox, you could trying using NODEFAULT and calling the .KeyPress event of the TextBox directly. Whether VFP handles it like a "regular keypress" at this point, I don't know.
>This seems simple enough. I want to use the KeyPress event in a text box to remap keys as they are typed. Below is a bit of sample code. Of course, it doesn't work...if it did, I wouldn't be issuing this plaintive plea for help. The example below is trying to map a lower case 'a' into a lower case 'b' and a lower case 'd' into a lower case 'e'. What it actually does is do nothing when 'a' or 'd' are pressed and behaves normally otherwise. How do I do this
correctly?
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>lnBefore=nKeyCode
>DO CASE
> CASE lnBefore=97
> lnAfter=98
> CASE lnBefore=100
> lnAfter=101
> OTHERWISE
> lnAfter=lnBefore
>ENDCASE
>IF lnBefore<>lnAfter
> NODEFAULT
> nKeyCode=lnAfter
> DODEFAULT()
>ENDIF
>