KeyPress event

Top  Previous  Next

Is triggered when a user presses and releases a key or a key combination.

Syntax

Object.KeyPress( nKeyCode, nShiftAltCtrl )

Parameters

nKeyCode

A number that identifies the key being pressed.

 

nShiftAltCtrl

A bit pattern that specifies which modifier keys have been pressed along with the key identified by nKeyCode. The following table lists the bits.

 

nShiftAltCtrl

Bit

Description

1

0

SHIFT

2

1

CTRL

4

2

ALT

 

The parameter is the sum of these bits. Some, none or all of these bits can be set. For example, if ALT and CTRL are pressed, the parameter is 6. Valid values range from 0 to 7. Call the BITTEST() function to test for a particular key. Pass the number of the bit as identified by the Bit column value.

Remarks

Applies to: TextBox Control | ListBox Control

Compatibility

Only nKeyCode = 13 and nShiftAltCtrl = 0 are currently supported. On the desktop, KeyPress is only supported in the ListBox control.

See also

INKEY()

BITTEST()