Consultor Eletrônico



Kbase P147461: Value returned from KeyCode property of ABL Form is different from keycode value in System.Windows.F
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   04/06/2009
Status: Unverified

SYMPTOM(s):

Comparing KeyCode from key event parameter in ABL Form to the key value in Keys object not matching

Value returned from KeyCode property of ABL Form is different from keycode value in System.Windows.Forms.Keys object

IF e:KeyCode = Keys:F2 THEN ... doesn't match

FACT(s) (Environment):

Windows
OpenEdge 10.2x

CAUSE:

This is expected behavior. The values returned by Keys:F2 and e:KeyCode are different data types and would not be expected to be the same.

FIX:

To determine whether the key pressed matches a specific key you should use the ToString() method on each side of the equation.
e.g.
IF e:KeyCode:ToString() = Keys:F2:ToString() THEN ...