From 62cf9b2bae7f5aba5fd1ca9788c93d4559eb9225 Mon Sep 17 00:00:00 2001 From: rich2014 Date: Wed, 19 Jun 2024 21:59:00 +0800 Subject: [PATCH] Cocoa: Fix the Scrolling issue on TCustomControl --- lcl/interfaces/cocoa/cocoaprivate.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoaprivate.pas b/lcl/interfaces/cocoa/cocoaprivate.pas index ac645f170f..c508fa159e 100644 --- a/lcl/interfaces/cocoa/cocoaprivate.pas +++ b/lcl/interfaces/cocoa/cocoaprivate.pas @@ -29,7 +29,7 @@ interface uses // rtl+ftl - Types, Classes, SysUtils, + Types, Classes, SysUtils, LazLoggerBase, Forms, // Libs MacOSAll, CocoaAll, CocoaUtils, CocoaGDIObjects, CocoaCursor, cocoa_extra, @@ -897,8 +897,14 @@ end; procedure TCocoaCustomControl.scrollWheel(event: NSEvent); begin - if not Assigned(callback) or not callback.scrollWheel(event) then + if Assigned(self.lclGetTarget) and (self.lclGetTarget is TScrollingWinControl) then begin inherited scrollWheel(event); + if Assigned(callback) then + callback.scrollWheel(event); + end else begin + if NOT Assigned(callback) or NOT callback.scrollWheel(event) then + inherited scrollWheel(event); + end; end; procedure TCocoaCustomControl.setFrame(aframe: NSRect);