ShiftState: Integer;
The ShiftState property returns the value that corresponds to the state of auxiliary keys (SHIFT, ALT, and CTRL) and mouse buttons during mouse actions.
The value of this property is a combination of values of the ShiftState enumeration type that specifies which mouse button was used to execute the action, and also which auxiliary keys (SHIFT, ALT, and CTRL) were pressed during mouse actions. The property returns 0 if the mouse button and auxiliary keys (SHIFT, ALT, and CTRL) are not used during mouse actions.
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: