From RAD Studio API Documentation
Jump to: navigation, search


procedure KeyDown(var Key: Word; Shift: TShiftState); override;


DYNAMIC void __fastcall KeyDown(System::Word &Key, System::Classes::TShiftState Shift);


Type Visibility Source Unit Parent
Vcl.DBCtrls TDBComboBox


Responds to key press events.

Vcl.DBCtrls.TDBComboBox.KeyDown inherits from Vcl.Controls.TWinControl.KeyDown. All content below this line refers to Vcl.Controls.TWinControl.KeyDown.

Responds to key press events.

When a windowed control receives a key-down message (WM_KEYDOWN) from Windows, its message handler calls the DoKeyDown method. If DoKeyDown determines that the control should, in fact, process the character, it calls KeyDown, passing the key code and shift-key state in the Key and Shift parameters, respectively.

KeyDown calls any event handler attached to the OnKeyDown event. Override KeyDown to provide other responses in addition to the event handler call.

The Key parameter is the key on the keyboard. For nonalphanumeric keys, you must use WinAPI virtual key codes to determine the key pressed. For more information see Representing Keys and Shortcuts.

The Shift parameter indicates whether the SHIFT, ALT, or CTRL keys are combined with the keystroke.

Either KeyDown or the OnKeyDown event handler it calls can suppress further processing of a key by setting the Key parameter to zero.

See Also