Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
KeyDown, KeyUp Events
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Occurs when the user presses (KeyDown) or releases (KeyUp) a key while an
object has the focus.
SUB Form_KeyDown (KeyCode AS INTEGER, Shift AS INTEGER)
SUB ctlname_KeyDown ([Index AS INTEGER,]KeyCode AS INTEGER,
Shift AS INTEGER)
SUB Form_KeyUp (KeyCode AS INTEGER, Shift AS INTEGER)
SUB ctlname_KeyUp ([Index AS INTEGER,]KeyCode AS INTEGER, Shift AS INTEGER)
■ KeyCode Key's key code. For example, KEY_F1 and KEY_HOME are the key
codes for the F1 and Home keys, respectively. To specify key
codes, use the constants in CONSTANT.BI, a file that you can
include with each module using the $INCLUDE metacommand.
See: ◄CONSTANT.BI File►
■ Shift State of the Shift, Ctrl, and Alt keys at the time of the
event. The Shift argument is a bit field, with the least-
significant bits corresponding to the Shift key (bit 0), the
Ctrl key (bit 1), and the Alt key (bit 2). These bits
correspond to the values 1, 2, and 4, respectively. Some,
all, or none of the bits can be set, indicating that some,
all, or none of the keys is pressed.
■ Index Uniquely identifies a control in a control array.
Applies To
◄Check Box Control► ◄Combo Box Control►
◄Command Button Control► ◄Directory List Box Control►
◄Drive List Box Control► ◄File List Box Control►
◄Form► ◄Horizontal Scroll Bar Control►
◄List Box Control► ◄Option Button Control►
◄Picture Box Control► ◄Text Box Control►
◄Vertical Scroll Bar Control►
See Also
◄ASCII Character Codes► ◄Creating a Control Array►
◄KeyPress Event► ◄Shift Arguments and Bit Fields►