win32: scroll fix from Martin Friebe (#0011768)

git-svn-id: trunk@16528 -
This commit is contained in:
paul 2008-09-10 22:26:13 +00:00
parent c93c466bc0
commit 5d8c7c393a

View File

@ -166,6 +166,20 @@ var
if not TWinControl(Sender).HandleAllocated then
exit;
// why coords are client? - they must be screen
with TLMMouseEvent(Message) do
begin
Pos.X := X;
Pos.Y := Y;
end;
ClientToScreen(Handle, Pos);
WParam := Windows.WParam(Longint(PointToSmallPoint(Pos)));
with TLMMouseEvent(Message) do
begin
X := Pos.X;
Y := Pos.Y;
end;
with TLMessage(Message) do
begin
Result := CallDefaultWindowProc(Handle, Msg, WParam, LParam);
@ -179,15 +193,6 @@ var
ScrollInfo.fMask := SIF_PAGE or SIF_POS or SIF_RANGE;
// if mouse is over horizontal scrollbar, scroll horizontally
// why coords are client? - they must be screen
with TLMMouseEvent(Message) do
begin
Pos.X := X;
Pos.Y := Y;
end;
ClientToScreen(Handle, Pos);
WParam := Windows.WParam(Longint(PointToSmallPoint(Pos)));
if Windows.SendMessage(Handle, WM_NCHITTEST, 0, WParam) = HTHSCROLL then
begin
ScrollBar := SB_HORZ;
@ -3428,3 +3433,4 @@ end;