Show: Delphi C++
Display Preferences

FMX.ListView.TListViewBase.KeyDown

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure KeyDown(var Key: Word; var KeyChar: System.WideChar;  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.ListView.pas
FMX.ListView.hpp
FMX.ListView TListViewBase

Description

Provides a response when a key is pressed down while the control has the keyboard focus.

FMX.ListView.TListViewBase.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

Key

Is the scan code of the pressed keyboard key or $0.

If a pressed key combination can be a shortcut, then Key <> 0 is a virtual key and KeyChar = #0.

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,

vkReturn = $0D; { 13 } corresponds to the RETURN keyboard key.
vkF2 = $71; { 113 } corresponds to the F2 keyboard key.

KeyChar

Is the pressed character (digit) or #0.

If a pressed key combination can be treated as a printable character or digit, then Key = 0 and KeyChar contains a pressed symbol according to the current keyboard's input language, keyboard mode (CAPS LOCK and NUM LOCK keys), keyboard Shift state, and IME state. Editors can use this symbol to add into a text being edited.

Shift

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.

See Also

Personal tools
In Other Languages
Previous Versions
Assistance