registerKeys

registerKeys(array: IntegerArray);

The registerKeys method of the Control class enables you to establish the entire set of key codes in which key events of the receiver control are interested. The array parameter is populated with all key codes. (For an example of registering keys, see the Form class registerFormKeys method.) This method applies only to controls that can get the focus and therefore receive key events.

By default, if a control has keyDown, keyPress, or keyUp event methods defined, those key events are sent for any key event for that control. In most situations, the control key events are interested only in specific keys (for example, the Tab key, arrow keys, and function keys).

The keyUp, keyPress, and keyDown events are available for forms and for some controls (for example, TextBox and Table controls). By default, key events are received by the form and the control that has focus. The registerFormKeys method applies only to key event methods implemented for the form. The registerKeys method applies only to key event methods implemented for the control.

After calling the registerKeys method with a key code list, the control events are called on the control only if the key that is pressed is in the supplied list. This results in not having to call the control key events for every key action, which reduces the number of events that must be sent and processed.

You can use this process in both standard (fat) client and for thin client mode.

Calling the registerKeys method with a null value or with an empty key code list results in all keys that are pressed being sent to the control key events again.

Each call to the registerKeys method entirely replaces any key code list that is currently in effect.

The key codes represent the actual physical keys. Registering the key code of 187 traps both the + and the = characters because they are the same key.

The Window class provides the class constants listed in the following table, which you can add to key code array parameter value to indicate that the key event should be sent only if the indicated special keys are also down when a specified key is pressed.

Window Class Constant Integer Value
RegisterKeys_Alt (#80000000)
RegisterKeys_Ctrl (#40000000)
RegisterKeys_Shift (#20000000)

You can use these class constants with a zero (0) key code array value, to indicate that the events for any key pressed are sent when that combination of special keys is also down (except for the special keys themselves). For an example of the use of these class constants, see the Form class registerFormKeys method.