Skip to content
Snippets Groups Projects
Commit bb0fd596 authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Setting the horizontal scrollbar can change the values for the

vertical one so make sure we compute them separately.
parent e3015641
No related branches found
No related tags found
No related merge requests found
...@@ -1513,10 +1513,6 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) ...@@ -1513,10 +1513,6 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
horzInfo.cbSize = sizeof(SCROLLINFO); horzInfo.cbSize = sizeof(SCROLLINFO);
horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left; 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 */ /* for now, we'll set info.nMax to the _count_, and adjust it later */
if (uView == LVS_LIST) if (uView == LVS_LIST)
{ {
...@@ -1527,18 +1523,12 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) ...@@ -1527,18 +1523,12 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
else if (uView == LVS_REPORT) else if (uView == LVS_REPORT)
{ {
horzInfo.nMax = infoPtr->nItemWidth; horzInfo.nMax = infoPtr->nItemWidth;
vertInfo.nMax = infoPtr->nItemCount;
vertInfo.nPage /= infoPtr->nItemHeight;
} }
else /* LVS_ICON, or LVS_SMALLICON */ else /* LVS_ICON, or LVS_SMALLICON */
{ {
RECT rcView; RECT rcView;
if (LISTVIEW_GetViewRect(infoPtr, &rcView)) if (LISTVIEW_GetViewRect(infoPtr, &rcView)) horzInfo.nMax = rcView.right - rcView.left;
{
horzInfo.nMax = rcView.right - rcView.left;
vertInfo.nMax = rcView.bottom - rcView.top;
}
} }
horzInfo.fMask = SIF_RANGE | SIF_PAGE; horzInfo.fMask = SIF_RANGE | SIF_PAGE;
...@@ -1546,6 +1536,27 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) ...@@ -1546,6 +1536,27 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE); SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE);
TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo)); 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.fMask = SIF_RANGE | SIF_PAGE;
vertInfo.nMax = max(vertInfo.nMax - 1, 0); vertInfo.nMax = max(vertInfo.nMax - 1, 0);
SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE); SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment