FMX.EditBox.Style.TStyledEditBox.KeyDown
Delphi
procedure KeyDown(var Key: Word; var KeyChar: Char; Shift: TShiftState); override;
C++
virtual void __fastcall KeyDown(System::Word &Key, System::WideChar &KeyChar, System::Classes::TShiftState Shift);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
protected | FMX.EditBox.Style.pas FMX.EditBox.Style.hpp |
FMX.EditBox.Style | TStyledEditBox |
Description
Provides a response when a key is pressed down while the control has the keyboard focus.
FMX.EditBox.Style.TStyledEditBox.KeyDown inherits from FMX.Controls.TControl.KeyDown. All content below this line refers to FMX.Controls.TControl.KeyDown.
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 and descendant of TControl classes--like TCustomGrid--call KeyDown from their methods handling key pressing. They decode the message parameters into the key code, character code, and shift state. They pass them into the called KeyDown method in the Key
, KeyChar
, and Shift
parameters, respectively:
Parameters | Descriptions |
---|---|
|
Is the scan code of the pressed keyboard key or If a pressed key combination can be a shortcut, then Physical scan codes of the same key can differ under different platforms (Windows or iOS). Platform-specific units (for example FMX.Platform.Mac.pas) should translate native scan codes to corresponding Windows codes defined in the UITypes unit. For example,
|
|
Is the pressed character (digit) or If a pressed key combination can be treated as a printable character or digit, then |
|
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
.
Override the protected KeyDown method to provide other responses when a key is down while the control has keyboard input focus.
See TCommonCustomForm.KeyDown for more information about parameters.