diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index e0b0e79f87..b77095aced 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -3462,6 +3462,8 @@ type procedure DoEndDrag(Target: TObject; X, Y: Integer); override; function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override; + function DoMouseWheelHorz(Shift: TShiftState; WheelDelta: Integer; + MousePos: TPoint): Boolean; override; procedure DoPaint; virtual; procedure DoPaintNode(Node: TTreeNode); virtual; procedure DoStartDrag(var DragObject: TDragObject); override; diff --git a/lcl/grids.pas b/lcl/grids.pas index 10a47f425d..e080d2ffec 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -982,6 +982,8 @@ type function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override; function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override; function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override; + function DoMouseWheelLeft(Shift: TShiftState; MousePos: TPoint): Boolean; override; + function DoMouseWheelRight(Shift: TShiftState; MousePos: TPoint): Boolean; override; procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double); override; procedure DoOnChangeBounds; override; @@ -7150,6 +7152,30 @@ begin {$ifdef dbgScroll}DebugLn('doMouseWheelUP END');{$endif} end; +function TCustomGrid.DoMouseWheelLeft(Shift: TShiftState; MousePos: TPoint + ): Boolean; +begin + {$ifdef dbgScroll}DebugLn('doMouseWheelLEFT INIT');{$endif} + Result:=inherited DoMouseWheelLeft(Shift, MousePos); + if not Result then begin + GridMouseWheel([ssCtrl], -1); + Result := True; // handled, no further scrolling by the widgetset + end; + {$ifdef dbgScroll}DebugLn('doMouseWheelLEFT END');{$endif} +end; + +function TCustomGrid.DoMouseWheelRight(Shift: TShiftState; MousePos: TPoint + ): Boolean; +begin + {$ifdef dbgScroll}DebugLn('doMouseWheelRIGHT INIT');{$endif} + Result:=inherited DoMouseWheelRight(Shift, MousePos); + if not Result then begin + GridMouseWheel([ssCtrl], 1); + Result := True; // handled, no further scrolling by the widgetset + end; + {$ifdef dbgScroll}DebugLn('doMouseWheelRIGHT END');{$endif} +end; + procedure TCustomGrid.DoOnChangeBounds; var OldTopLeft: TPoint; diff --git a/lcl/include/treeview.inc b/lcl/include/treeview.inc index b82b6b586d..9143cf25b9 100644 --- a/lcl/include/treeview.inc +++ b/lcl/include/treeview.inc @@ -4698,6 +4698,23 @@ begin UpdateTooltip(MousePos.X, MousePos.Y); end; +function TCustomTreeView.DoMouseWheelHorz(Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint): Boolean; +var + NDelta: integer; +const + cScrollStep = 50; +begin + Result:=inherited DoMouseWheelHorz(Shift, WheelDelta, MousePos); + if not Result then + begin + NDelta := (WheelDelta * cScrollStep) div 120; + ScrolledLeft := ScrolledLeft + NDelta; + Result := true; + end; + UpdateTooltip(MousePos.X, MousePos.Y); +end; + function TCustomTreeView.DoDragMsg(ADragMessage: TDragMessage; APosition: TPoint; ADragObject: TDragObject; ATarget: TControl; ADocking: Boolean):LRESULT; begin Result:=inherited;