comctl32: Update ticks on TBM_SETRANGE.

This commit is contained in:
Nikolay Sivov 2012-02-12 16:29:54 +03:00 committed by Alexandre Julliard
parent 11de98be34
commit e508eae7d7
2 changed files with 19 additions and 4 deletions

View file

@ -1034,6 +1034,15 @@ static void test_TBS_AUTOTICKS(void)
ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
expect(91, ret);
ret = SendMessage(hWnd, TBM_SETRANGEMIN, TRUE, 0);
expect(0, ret);
/* TBM_SETRANGE rebuilds tics */
ret = SendMessage(hWnd, TBM_SETRANGE, TRUE, MAKELONG(10, 200));
expect(0, ret);
ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0);
expect(191, ret);
DestroyWindow(hWnd);
}

View file

@ -1151,10 +1151,13 @@ TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
static inline LRESULT
TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG range)
{
infoPtr->lRangeMin = (SHORT)LOWORD(lRange);
infoPtr->lRangeMax = (SHORT)HIWORD(lRange);
BOOL changed = infoPtr->lRangeMin != (SHORT)LOWORD(range) ||
infoPtr->lRangeMax != (SHORT)HIWORD(range);
infoPtr->lRangeMin = (SHORT)LOWORD(range);
infoPtr->lRangeMax = (SHORT)HIWORD(range);
if (infoPtr->lPos < infoPtr->lRangeMin) {
infoPtr->lPos = infoPtr->lRangeMin;
@ -1169,7 +1172,10 @@ TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
if (changed && (infoPtr->dwStyle & TBS_AUTOTICKS))
TRACKBAR_RecalculateTics (infoPtr);
if (redraw) TRACKBAR_InvalidateAll(infoPtr);
return 0;
}