From bb0fd59674f353f71e5e970886ae009df591d233 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 18 Nov 2002 19:51:11 +0000 Subject: [PATCH] Setting the horizontal scrollbar can change the values for the vertical one so make sure we compute them separately. --- dlls/comctl32/listview.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 918aaae4a35..4ebfa51a7d8 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -1513,10 +1513,6 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) horzInfo.cbSize = sizeof(SCROLLINFO); horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left; - ZeroMemory(&vertInfo, sizeof(SCROLLINFO)); - vertInfo.cbSize = sizeof(SCROLLINFO); - vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top; - /* for now, we'll set info.nMax to the _count_, and adjust it later */ if (uView == LVS_LIST) { @@ -1527,18 +1523,12 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) else if (uView == LVS_REPORT) { horzInfo.nMax = infoPtr->nItemWidth; - vertInfo.nMax = infoPtr->nItemCount; - vertInfo.nPage /= infoPtr->nItemHeight; } else /* LVS_ICON, or LVS_SMALLICON */ { RECT rcView; - if (LISTVIEW_GetViewRect(infoPtr, &rcView)) - { - horzInfo.nMax = rcView.right - rcView.left; - vertInfo.nMax = rcView.bottom - rcView.top; - } + if (LISTVIEW_GetViewRect(infoPtr, &rcView)) horzInfo.nMax = rcView.right - rcView.left; } horzInfo.fMask = SIF_RANGE | SIF_PAGE; @@ -1546,6 +1536,27 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE); TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo)); + /* Setting the horizontal scroll can change the listview size + * (and potentially everything else) so we need to recompute + * everything again for the vertical scroll + */ + + ZeroMemory(&vertInfo, sizeof(SCROLLINFO)); + vertInfo.cbSize = sizeof(SCROLLINFO); + vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top; + + if (uView == LVS_REPORT) + { + vertInfo.nMax = infoPtr->nItemCount; + vertInfo.nPage /= infoPtr->nItemHeight; + } + else if (uView != LVS_LIST) /* LVS_ICON, or LVS_SMALLICON */ + { + RECT rcView; + + if (LISTVIEW_GetViewRect(infoPtr, &rcView)) vertInfo.nMax = rcView.bottom - rcView.top; + } + vertInfo.fMask = SIF_RANGE | SIF_PAGE; vertInfo.nMax = max(vertInfo.nMax - 1, 0); SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE); -- 2.11.4.GIT