From 916bee86f84126fc1d288865c5b3006ad64502af Mon Sep 17 00:00:00 2001 From: ondrej Date: Sun, 29 Nov 2015 22:21:49 +0000 Subject: [PATCH] LCL: support VertScrollBar.Increment by scrollingwincontrol on Windows git-svn-id: trunk@50527 - --- lcl/forms.pp | 1 + lcl/include/scrollingwincontrol.inc | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lcl/forms.pp b/lcl/forms.pp index 8d425f5ec3..e0685c3608 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -166,6 +166,7 @@ type procedure WMSize(var Message: TLMSize); message LM_Size; procedure WMHScroll(var Message : TLMHScroll); message LM_HScroll; procedure WMVScroll(var Message : TLMVScroll); message LM_VScroll; + procedure WMMouseWheel(var Message: TLMMouseEvent); message LM_MOUSEWHEEL; procedure ComputeScrollbars; virtual; procedure SetAutoScroll(Value: Boolean); virtual; procedure Loaded; override; diff --git a/lcl/include/scrollingwincontrol.inc b/lcl/include/scrollingwincontrol.inc index e3b98536b4..fe0070b0a2 100644 --- a/lcl/include/scrollingwincontrol.inc +++ b/lcl/include/scrollingwincontrol.inc @@ -304,6 +304,18 @@ begin HorzScrollbar.ScrollHandler(Message); end; +procedure TScrollingWinControl.WMMouseWheel(var Message: TLMMouseEvent); +begin + // support VertScrollBar.Increment on Windows. + // The code has no meaning on other OS because scrolling is handled there directly by the OS + if Mouse.WheelScrollLines > 0 then + Message.WheelDelta := + (Min(High(Message.WheelDelta), Max(Low(Message.WheelDelta), + (VertScrollBar.Increment * Message.WheelDelta))) div 120) * 120; + + inherited WMMouseWheel(Message); +end; + constructor TScrollingWinControl.Create(TheOwner : TComponent); begin Inherited Create(TheOwner);