[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TControl.OnMouseWheel

Event handler for mouse wheel turned.

## Declaration

Source position: controls.pp line 1594

`protected property TControl.OnMouseWheel : TMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;`

## Description

OnMouseWheel is a TMouseWheelEvent property with the event handler signalled when a mouse wheel movement occurs in for the control. By default all mouse wheel actions are translated into scroll events. Write an OnMouseWheel handler to react when the mouse wheel is rotated.

Arguments for the event handler routine include:

Sender
  The control for the event notification.
Shift
  The shift modifier in effect when the action occurred.
WheelDelta
  The relative number of units and direction the mouse wheel was rotated.
MousePos
  The location for the mouse pointer when the event occurred.
Handled
  A variable argument which indicates if the mouse wheel movement is handled in the event handler.

OnMouseWheel is signalled (when assigned) from the DoMouseWheel method, and occurs when the LM_MOUSEWHEEL message is handled in the WMMouseWheel method. If the event handler does not set the Handled argument to True, other assigned handler routines are signalled. These include control handlers added using the AddHandler method, as well as OnMouseWheelDown and OnMouseWheelUp.

The value in WheelDelta argument is used to determine the handler signalled. OnMouseWheelUp is used when the delta value (or the relative number of units of movement) is 0 (zero) or a positive number. OnMouseWheelDown is used when the delta value is a negative number.

Neither OnMouseWheelUp nor OnMouseWheelDown include the wheel delta value; they are simple notifications that the event has occurred at a given position.

## See also

TControl.OnMouseWheelDown |  | Event handler signalled for a downward movement of the mouse wheel.
TControl.OnMouseWheelLeft |  | Event handler signalled for a leftward movement of the mouse wheel.
TControl.OnMouseWheelRight |  | Event handler signalled for a rightward movement of the mouse wheel.
TControl.OnMouseWheelUp |  | Event handler signalled for an upward movement of the mouse wheel.
TControl.DoMouseWheel |  | Signals the OnMouseWheel handlers, when the mouse wheel has been turned.
TControl.WMMouseHWheel |  | Handles horizontal mouse wheel messages for the control.
TControl.DoCallMouseWheelEventHandler |  | Executes assigned mouse wheel events until a handler is found for the event notifications.
TMouseWheelEvent |  | Specifies an event handler used to respond to mouse wheel events.