Key: Integer;
The Key property determines a code of the key that was pressed or released.
Use values available in the Keys enumeration to check keys. The characters in upper and lower case and Cyrillic and Latin characters do not differ in this property.
Executing the example requires a form. Several components that can receive focus are placed on the form. The following procedure is used as a handler of the OnKeyDown event for all components:
Sub ProcedureOnKeyDown(Sender: Object; Args: IKeyEventArgs);
Begin
If (Args.ShiftState = ShiftState.Ctrl) And (Args.Key = Keys.B) Then
Text := (Sender As IControl).Name;
End If;
End Sub ProcedureOnKeyDown;
After executing the example, if CTRL+B was pressed in the area of any component, the name of this component is displayed in the form name.
See also: