IKeyEventArgs.ShiftState

Syntax

ShiftState: Integer;

Description

The ShiftState property returns the value that corresponds to the state of auxiliary keys (SHIFT, ALT, and CTRL) when the keyboard actions are executed.

Comments

Value of this property is a combination of values of the ShiftState enumerated type. This combination specifies what auxiliary keys (SHIFT, ALT, and CTRL) were pressed or released when executing operations using the keyboard. The property returns the 0 value if one of auxiliary keys (SHIFT, ALT, and CTRL) was not used when executing operations using the keyboard.

Example

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.Shift + ShiftState.Ctrl) And (Args.Key = Keys.B) Then

Text := (Sender As IControl).Name;

End If;

End Sub ProcedureOnKeyDown;

After executing the example, if SHIFT+CTRL+B was pressed in the area of any component, the name of this component is displayed in the form name.

See also:

IKeyEventArgs | ShiftState