Vcl.Controls.TControl.DoMouseWheel

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

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

Properties

Type Visibility Source Unit Parent
function protected
Vcl.Controls.pas
Vcl.Controls.hpp
Vcl.Controls TControl

Description

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