From Appmethod Libraries
Jump to: navigation, search

Object Pascal

procedure MouseWheel(Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); virtual;


virtual void __fastcall MouseWheel(System::Classes::TShiftState Shift, int WheelDelta, bool &Handled);


Type Visibility Source Unit Parent
FMX.Controls TControl


OnMouseWheel event dispatcher.

A control calls MouseWheel in response to any of mouse wheel messages, decoding the message parameters into the shift-key state, wheel rotation, and handle, which it passes in the Shift, WheelDelta, and Handled parameters, respectively:

  • Shift indicates which shift keys--SHIFT, CTRL, ALT, and CMD (only for Mac)--were down when the pressed mouse button is released.
  • WheelDelta indicates the distance the wheel was rotated. WheelDelta is positive if the mouse was rotated upward, negative if the mouse was rotated downward.
  • Handled indicates whether the scroll bar was already moved, depending on the WheelDelta value. If one of the scrolls bars (vertical or horizontal) was already handled or it does not exist, MouseWheel tries to apply the rolling on the other scroll bar, if it exists.

Override the protected MouseWheel method to provide other responses when the mouse wheel is rotated while the cursor is over the control.

See Also