ShiftState: Integer;
The ShiftState property returns a value that corresponds to the state of auxiliary keys (SHIFT, ALT and CTRL) and mouse buttons when the actions are executed with the mouse.
The value of this property is a combination of values of the ShiftState enumeration type that specifies which mouse button was used to perform the action, and also which auxiliary keys (SHIFT, ALT and CTRL) were pressed on performing actions with the mouse. The property returns 0, if the mouse button and auxiliary keys (SHIFT, ALT and CTRL) are not used when the actions are performed with the mouse.
Executing the example requires a form. Several components are placed on the form. The following procedure is used as a handler of the OnClick event for all components:
Sub ProcedureOnClick(Sender: Object; Args: IMouseEventArgs);
Begin
If (Args.ShiftState = ShiftState.Ctrl) And (Args.Button = 0) Then
Text := (Sender As IControl).Name;
End If;
End Sub ProcedureOnClick;
After executing the example, if CTRL+left mouse button combination was pressed in the area of any component, the name of this component is displayed in the form name.
See also: