win32: fix scrolling for spin, combo and listview. Issue #31507

git-svn-id: trunk@54366 -
This commit is contained in:
ondrej 2017-03-08 14:29:37 +00:00
parent 122f7b0582
commit f5089e9ae4
3 changed files with 16 additions and 10 deletions

View File

@ -2488,6 +2488,17 @@ begin
if PLMsg^.Result = 0 then
WinProcess := True;
LM_MOUSEWHEEL:
begin
if (PLMsg^.Result = 0)
and (
(lWinControl is TCustomListView)
or (lWinControl is TCustomComboBox)
or (lWinControl is TCustomFloatSpinEdit))
then
WinProcess := True;
end;
WM_SYSCOMMAND:
WinProcess := WmSysCommandProcess;
@ -2592,6 +2603,10 @@ begin
end;
end;
if (PLMsg^.msg = LM_MOUSEWHEEL) // send unhandled scroll messages to parent
and (PLMsg^.Result = 0) and (lWinControl<>nil) and (lWinControl.Parent <> nil) then
lWinControl.Parent.WindowProc(PLMsg^);
// ignore WM_(SYS)CHAR message if LCL handled WM_(SYS)KEYDOWN
if ((Msg = WM_KEYDOWN) or (Msg = WM_SYSKEYDOWN)) then
if (PLMsg^.Result = 0) then

View File

@ -33,7 +33,7 @@ uses
// LCL
LCLPlatformDef, InterfaceBase, LCLIntf, LclProc, LCLType, LMessages,
Controls, Buttons, Forms, Dialogs, GraphMath, GraphType, StdCtrls,
Graphics, Menus, ComCtrls, Themes, Win32Def,
Graphics, Menus, ComCtrls, Themes, Win32Def, Spin,
// LazUtils
LazUTF8, Translations;
{, Win32Debug}

View File

@ -180,13 +180,6 @@ var
ClientToScreen(Handle, Pos);
SystemWParam := Windows.WParam(Longint(PointToSmallPointNoChecks(Pos)));
if Sender is TListView then
begin // we need this workaround to make TListView scroll -> forward WM_MOUSEWHEEL directly to it
MMessage^.Result := CallDefaultWindowProc(Handle, MMessage^.Msg, TLMessage(Message).WParam, TLMessage(Message).LParam);
// Windows handled it, so exit here.
if MMessage^.Result<>0 then exit;
end;
// send scroll message
FillChar(ScrollInfo, sizeof(ScrollInfo), #0);
ScrollInfo.cbSize := sizeof(ScrollInfo);
@ -234,8 +227,6 @@ var
MMessage^.Result := Windows.SendMessage(Handle, ScrollMsg, SystemWParam, HWND(nil));
end;
if (MMessage^.Result = 0) and (TControl(Sender).Parent <> nil) then
TControl(Sender).Parent.WindowProc(TLMessage(Message));
end;
begin