mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
LCL: Fix mouse position in unhandled mouse-wheel event to be relative to parent. Issue #39621.
This commit is contained in:
parent
07eb443322
commit
2d93d8f51b
@ -239,8 +239,15 @@ var
|
|||||||
then // the above 3 controls need windows to handle wheel messages
|
then // the above 3 controls need windows to handle wheel messages
|
||||||
MMessage^.Result := CallDefaultWindowProc(Handle, MMessage^.Msg, TLMessage(Message).WParam, TLMessage(Message).LParam);
|
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));
|
TControl(Sender).Parent.WindowProc(TLMessage(Message));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user