RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TControl.DoMouseWheel Method

Processes mouse wheel motion.

Pascal
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; dynamic;
C++
__fastcall Boolean DoMouseWheel(TShiftState Shift, int WheelDelta, TPoint MousePos);

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 handlers. 

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

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!