From RAD Studio API Documentation
Jump to: navigation, search


function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer;  MousePos: TPoint): Boolean; dynamic;


DYNAMIC bool __fastcall DoMouseWheel(System::Classes::TShiftState Shift, int WheelDelta, const System::Types::TPoint &MousePos);


Type Visibility Source Unit Parent
function protected
Vcl.Controls TControl


Processes mouse wheel motion.

DoMouseWheel is called automatically when the user rotates the mouse wheel.

The Shift parameter indicates the current state of the SHIFT, ALT, and CTRL keys.

The WheelDelta parameter indicates the distance the wheel was rotated. WheelDelta is positive if the mouse was rotated upward, negative if the mouse was rotated downward.

The MousePos parameter indicates the current position of the mouse pointer.

DoMouseWheel returns true if an event handler was found and indicated that it handled the event.

As implemented in TControl, DoMouseWheel first attempts to call the OnMouseWheel event handler. If this routine exists and succesfully handles the event, DoMouseWheel returns true. Otherwise, DoMouseWheel repeatedly calls DoMouseWheelDown or DoMouseWheelUp, depending on the direction the user turned the mouse wheel. These routines, in turn, call the OnMouseWheelUp or OnMouseWheelDown event handler.

Before the first call to DoMouseWheelDown or DoMouseWheelUp, DoMouseWheel adds WheelDelta to the WheelAccumulator property. After each call, DoMouseWheel adjusts WheelAccumulator towards zero; each adjustment is by an internal constant that defines the minimum meaningful wheel motion. When the absolute value of of WheelAccumulator drops below the value of this constant, DoMouseWheel exits, returning the value returned by the final call to DoMouseWheelDown or DoMouseWheelUp.

See Also