FMX.Controls.TControl.KeyDown
Delphi
procedure KeyDown(var Key: Word; var KeyChar: WideChar; Shift: TShiftState); virtual;
C++
virtual void __fastcall KeyDown(System::Word &Key, System::WideChar &KeyChar, System::Classes::TShiftState Shift);
Eigenschaften
Typ | Sichtbarkeit | Quelle | Unit | Übergeordnet |
---|---|---|---|---|
procedure function |
protected | FMX.Controls.pas FMX.Controls.hpp |
FMX.Controls | TControl |
Description
Provides a response when a key is pressed down while the control has the keyboard focus.
If the pressed key is the Applications key (Key = vkApps
), then KeyDown shows the context menu of the control. Otherwise, KeyDown calls the OnKeyDown event handler if one is assigned.
TCommonCustomForm und abgeleitete Klassen von TControl-Klassen – wie TCustomGrid – rufen KeyDown aus ihren Methoden zur Behandlung von Tasteneingaben auf. Diese Methoden decodieren die Botschaftsparameter in den Tastencode, Zeichencode und den Umschaltstatus. Diese werden in den Parametern Key
, KeyChar
bzw. Shift
an die aufgerufene KeyDown-Methode übergeben:
Parameters | Descriptions |
---|---|
|
Is the scan code of the pressed keyboard key or
|
|
Is the pressed character (digit) or |
|
Indicates which shift keys--SHIFT, CTRL, ALT, and CMD (only for Mac)--were down when the specified key was pressed with the control in focus. |
If the control has successfully processed the pressed key combination and no additional processing is required, then KeyDown assigns Key = 0
and KeyChar = #0
.
Überschreiben Sie die als protected deklarierte Methode KeyDown, um Reaktionen auf eine gedrückte Taste bereitzustellen, wenn das Steuerelement den Tastatureingabefokus besitzt.
See TCommonCustomForm.KeyDown for more information about parameters.
Return
und Eingabe
, aber nicht Löschen
. Beachten Sie, dass andere Software-Eingabemethoden unabhängig von der Version möglicherweise nie KeyEvents senden.