Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: How To (Forms, Reports, and more) > Forms > Technical Documents > Capturing Keyboard Events

On Key Up EEP

Scroll Prev Top Next More

The On Key Up EEP will execute when the user releases a key. Within the On Key Up EEP, the GETPROPERTY LastKeyUp parameter is accepted to recognize what key is released.

 

Syntax:

 

GETPROPERTY FormComponentID| 'LastKeyUp' 'iKeyCode'

 

Where:

 

The returned integer value for iKeyCode is the virtual-key code of the of physical key on the keyboard.

 

Notes:

 

The virtual-key code is not to be confused with the actual keyboard characters. See Virtual-Key Codes.

 

The key code value returned by the LastKeyUp syntax is only recognized within the On Key Up EEP.

 

Capturing Shift, Ctrl, and Alt

The GETPROPERTY command also supports the recognition if the Shift, Ctrl, and Alt keys when pressed.

 

GETPROPERTY FormComponentID| 'ShiftIsPressed' 'iShiftIsPressed'

GETPROPERTY FormComponentID| 'CtrlIsPressed' 'iCtrlIsPressed'

GETPROPERTY FormComponentID| 'AltIsPressed' 'iAltIsPressed'

 

The returned integer value for ShiftIsPressed, CtrlIsPressed, and AltIsPressedand is 1 if the appropriate key is pressed. The returned value of 1 by the syntax is recognized within the "On Key Down", "On Key Press", and "On Key Up" EEPs.

 

Example:

 

-- To capture [F1] and display a custom Help file for a form

 

-- Form "On Before Start" EEP

SET VAR vIsKeyDown INTEGER = 0

RETURN

 

-- Form "On Key Up" EEP

IF vIsKeyDown = 1 THEN

RETURN

ENDIF

 

SET VAR vIsKeyDown = 1

SET VAR iKeyCode TEXT = NULL

 

GETPROPERTY TrapF1KeyForm| 'LastKeyUp' 'iKeyCode'

 

IF iKeyCode = '112' THEN

LAUNCH CustomHelpFile.chm

ENDIF

 

SET VAR vIsKeyDown = 0

RETURN