Top
PowerCOBOL V11.0 Reference
FUJITSU Software

6.23 KeyDown Event

Description:

Generated when a key is pressed and passed to the control that has the focus.

The KeyPress and KeyUp events are usually generated after the KeyDown event.

If a key is pressed and kept depressed, multiple KeyDown and KeyPress events are generated before a KeyUp event.

Note that if you press a toggle key (e.g. Caps Lock, Num Lock):

The order of events may be changed.

One of these events may not be generated.

To support special keystrokes, such as short-cuts, on the form, see the PreKeyDown event.

TreeView and
ListView

KeyDown events are not generated when a label is being edited.

Others

Event is not generated in the following cases:

  1. When the Tab key is pressed.

  2. When an access (mnemonic) key is pressed.

  3. When an arrow key is pressed.
    Note that if a control, which uses arrow keys (e.g. ComboBox control, ScrollBar control), has the focus, the KeyDown and KeyUp events are generated.

  4. When a function key, which was defined in the CommandButton property page, is pressed.

  5. When a short-cut key, which was defined in the MenuItem property page, is pressed.

  6. If the form contains the following controls, when the ENTER key is pressed:

    • A control, which has focus, does not use ENTER key
      (e.g. Table control, a TextBox control whose MultiLine property is True, use the ENTER key.)

    • A CommandButton control, whose Default property is True, has the focus.

  7. If there are following controls on the form, when ESCAPE key is pressed:

    • The control, which has focus, does not use ESCAPE key.

    • CommandButton control, whose Cancel property is True.

Used in controls:

CheckBox

ComboBox

CommandButton

DriveList

Edit

FileList

FolderList

ListBox

ListView

OptionButton

ScrollBar

Slider

Tab

Table

TextBox

TreeView

Used in objects:

Form

Parameters:

1. [VT_I4 - Index S9(9) COMP-5]

2. VT_I2 - KeyCode S9(4) COMP-5

3. VT_I2 - ShiftState S9(4) COMP-5

Description of parameters:

  1. Index: When the control is part of an array, Index contains the control's index in the array.

  2. KeyCode: The key code that was pressed. See Key Code Constants for details of key codes.

  3. ShiftState: Bit mask settings indicate the state of each of the shift keys - Shift, Ctrl and ALT. Numbering the bits 1 to 8, from least significant to most significant, the bit mapping is:
    1 - Shift key(POW-SHIFTSTATE-SHIFT)
    2 - Ctrl key(POW-SHIFTSTATE-CTRL)
    3 - Alt key(POW-SHIFTSTATE-ALT)
    For example if the parameter has a value of 6 (binary 00000110), this indicates that the Ctl and Alt keys are depressed.