Win32: fix drawing selection range if TTrackBar.Reversed is True. Resolves issue #40080.

This commit is contained in:
Bart 2023-01-06 11:08:22 +01:00
parent 84a8d1b168
commit 0e8088ef64

View File

@ -1015,8 +1015,16 @@ begin
Windows.SendMessage(wHandle, TBM_CLEARSEL, Windows.WPARAM(True), 0)
else
begin
Windows.SendMessage(wHandle, TBM_SETSELSTART, Windows.WParam(False), SelStart);
Windows.SendMessage(wHandle, TBM_SETSELEND, Windows.WParam(True), SelEnd)
if (GetWindowLong(ATrackBar.Handle, GWL_STYLE) and TBS_REVERSED) <> 0 then
begin
Windows.SendMessage(wHandle, TBM_SETSELSTART, Windows.WParam(False), ATrackBar.Max-SelEnd); //SelStart/SelEnd are not relative to Min/Max
Windows.SendMessage(wHandle, TBM_SETSELEND, Windows.WParam(True), ATrackBar.Max-SelStart)
end
else
begin
Windows.SendMessage(wHandle, TBM_SETSELSTART, Windows.WParam(False), SelStart);
Windows.SendMessage(wHandle, TBM_SETSELEND, Windows.WParam(True), SelEnd)
end;
end;
end;
end;