Event fired after a keypress has been processed for a control.

Parameters

<char expN>

The ASCII value of the key pressed, or the value returned by the key event.

<position expN>

The current position of the cursor in the control.

<shift expL>

Whether the Shift key was down.

<ctrl expL>

Whether the Ctrl key was down.

Property of

ComboBox, Entryfield, ListBox, SpinBox

Description

Use onKey to evaluate the contents of a control, or to perform some action after each keystroke has been processed either by the control’s Key event, or the operating system.

Keystrokes simulated by a control’s keyboard( ) method will fire the onKey event, as will the KEYBOARD command when the control has focus.

Note

You cannot trap all keystroke combinations with onKey. Many Alt+ and Ctrl+ key combinations are reserved for menu and operating system commands, such as Ctrl+X and Ctrl+V for standard Windows cut-and-paste, Alt+F4 to close the application window, etc. These and other common shortcut key combinations will not cause a control’s onKey event to fire.