Vcl.StdCtrls.TCustomEdit.KeyDown

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

Type Visibility Source Unit Parent
procedure
function
protected
Vcl.StdCtrls.pas
Vcl.StdCtrls.hpp
Vcl.StdCtrls TCustomEdit

Description

Responds to key press events.

Vcl.StdCtrls.TCustomEdit.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