KeyEventArgs.Create

Syntax

Create(Key: Integer; ShiftState: Integer);

Parameters

Key - code of the keyboard key.

ShiftState - code of pressing the auxiliary keys (SHIFT, ALT, and CTRL). Use ShiftState enumeration type to assign the required value. If it is not necessary to use auxiliary keys, 0 should be passed as a value.

Description

The Create constructor creates an argument of the OnKeyDown and OnKeyUp event.

Example

Executing the example requires a form, a button named Button1 on it and the EditBox component named EditBox1. There is a handler of the OnKeyDown event for EditBox1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Argument: IKeyEventArgs;

Begin

Argument := New KeyEventArgs.Create(Keys.A, ShiftState.Shift);

EditBox1.OnKeyDown(EditBox1, Argument);

End Sub Button1OnClick;

After executing the example pressing the button generates the event of pressing the SHIFT+A keys in the area of the component for the EditBox1 component.

See also:

KeyEventArgs

ShiftState