LCL: Fix mouse position in unhandled mouse-wheel event to be relative to parent. Issue #39621.

This commit is contained in:
wp_xyz 2022-01-30 22:18:03 +01:00
parent 07eb443322
commit 2d93d8f51b

View File

@ -239,8 +239,15 @@ var
then // the above 3 controls need windows to handle wheel messages
MMessage^.Result := CallDefaultWindowProc(Handle, MMessage^.Msg, TLMessage(Message).WParam, TLMessage(Message).LParam);
if (MMessage^.Result = 0) and (TControl(Sender).Parent <> nil) then // send unhandled scroll messages to parent
// Send unhandled scroll messages to parent
if (MMessage^.Result = 0) and (TControl(Sender).Parent <> nil) then
begin
// Transform mouse coordinate to be relative to parent
Pos := TControl(Sender).Parent.ScreenToClient(Pos);
MMessage^.X := Pos.X;
MMessage^.Y := Pos.Y;
TControl(Sender).Parent.WindowProc(TLMessage(Message));
end;
end;
begin