Commit cd55d747 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/trackbar: Update thumb on range change.

parent 099eda8e
......@@ -687,6 +687,7 @@ static void test_position(void)
static void test_range(void)
{
HWND hWndTrackbar;
RECT rect1, rect2;
int r;
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
......@@ -752,6 +753,28 @@ static void test_range(void)
ok_sequence(sequences, TRACKBAR_SEQ_INDEX, range_test_seq, "range test sequence", TRUE);
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_range_test_seq, "parent range test sequence", TRUE);
/* TBM_SETRANGE updates thumb visual position (rectangle) if needed */
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 0));
ok(r == 0, "got %d\n", r);
SendMessageA(hWndTrackbar, TBM_SETPOS, TRUE, 0);
RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW);
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, TRUE, MAKELONG(-10, 10));
ok(r == 0, "got %d\n", r);
RedrawWindow(hWndTrackbar, NULL, 0, RDW_UPDATENOW);
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect2);
ok(!EqualRect(&rect1, &rect2), "thumb rectangle not updated\n");
/* change range back, don't force repaint */
r = SendMessageA(hWndTrackbar, TBM_SETRANGE, FALSE, MAKELONG(-10, 0));
ok(r == 0, "got %d\n", r);
SendMessageA(hWndTrackbar, TBM_GETTHUMBRECT, 0, (LPARAM)&rect1);
ok(EqualRect(&rect1, &rect2), "thumb rectangle not updated\n");
DestroyWindow(hWndTrackbar);
}
......
......@@ -1245,21 +1245,21 @@ TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG range)
infoPtr->lRangeMin = (SHORT)LOWORD(range);
infoPtr->lRangeMax = (SHORT)HIWORD(range);
if (infoPtr->lPos < infoPtr->lRangeMin) {
/* clip position to new min/max limit */
if (infoPtr->lPos < infoPtr->lRangeMin)
infoPtr->lPos = infoPtr->lRangeMin;
infoPtr->flags |= TB_THUMBPOSCHANGED;
}
if (infoPtr->lPos > infoPtr->lRangeMax) {
if (infoPtr->lPos > infoPtr->lRangeMax)
infoPtr->lPos = infoPtr->lRangeMax;
infoPtr->flags |= TB_THUMBPOSCHANGED;
}
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
if (changed && (infoPtr->dwStyle & TBS_AUTOTICKS))
TRACKBAR_RecalculateTics (infoPtr);
if (changed) {
if (infoPtr->dwStyle & TBS_AUTOTICKS)
TRACKBAR_RecalculateTics (infoPtr);
infoPtr->flags |= TB_THUMBPOSCHANGED;
}
if (redraw) TRACKBAR_InvalidateAll(infoPtr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment