Create(Key: Integer; ShiftState: Integer);
Key. Keyboard key code.
ShiftState. Auxiliary key press code (SHIFT, ALT and CTRL). Use the ShiftState enumeration type to assign the required value. If it is not necessary to use auxiliary keys, 0 should be passed as a value.
The Create constructor creates an argument of the OnKeyDown and OnKeyUp event.
Executing the example requires a form, the Button1 button on the form, 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, clicking the button generates the event of pressing the SHIFT+A keys in the component area.
See also: