Commit fa93b446 authored by Chris Morgan's avatar Chris Morgan Committed by Alexandre Julliard

Listview should scroll by at least one column, fixes bug where item

being wider than listview prevents any scrolling from occuring. Added printing of the scroll code text during tracing of scroll functions.
parent adf55c25
...@@ -362,7 +362,6 @@ typedef struct tagLISTVIEW_INFO ...@@ -362,7 +362,6 @@ typedef struct tagLISTVIEW_INFO
TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, debugrect(&iP->rcList)); \ TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, debugrect(&iP->rcList)); \
} while(0) } while(0)
/* /*
* forward declarations * forward declarations
*/ */
...@@ -674,7 +673,6 @@ undo: ...@@ -674,7 +673,6 @@ undo:
return text; return text;
} }
static char* debuglvhittestinfo(const LVHITTESTINFO *lpht) static char* debuglvhittestinfo(const LVHITTESTINFO *lpht)
{ {
if (lpht) if (lpht)
...@@ -686,6 +684,24 @@ static char* debuglvhittestinfo(const LVHITTESTINFO *lpht) ...@@ -686,6 +684,24 @@ static char* debuglvhittestinfo(const LVHITTESTINFO *lpht)
} else return "(null)"; } else return "(null)";
} }
/* Return the corresponding text for a given scroll value */
static inline LPCSTR debugscrollcode(int nScrollCode)
{
switch(nScrollCode)
{
case SB_LINELEFT: return "SB_LINELEFT";
case SB_LINERIGHT: return "SB_LINERIGHT";
case SB_PAGELEFT: return "SB_PAGELEFT";
case SB_PAGERIGHT: return "SB_PAGERIGHT";
case SB_THUMBPOSITION: return "SB_THUMBPOSITION";
case SB_THUMBTRACK: return "SB_THUMBTRACK";
case SB_ENDSCROLL: return "SB_ENDSCROLL";
case SB_INTERNAL: return "SB_INTERNAL";
default: return "unknown";
}
}
/******** Notification functions i************************************/ /******** Notification functions i************************************/
static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh) static LRESULT notify_hdr(LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
...@@ -1513,6 +1529,11 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) ...@@ -1513,6 +1529,11 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
{ {
INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr); INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol; horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol;
/* scroll by at least one column per page */
if(horzInfo.nPage < infoPtr->nItemWidth)
horzInfo.nPage = infoPtr->nItemWidth;
horzInfo.nPage /= infoPtr->nItemWidth; horzInfo.nPage /= infoPtr->nItemWidth;
} }
else if (uView == LVS_REPORT) else if (uView == LVS_REPORT)
...@@ -1543,6 +1564,11 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) ...@@ -1543,6 +1564,11 @@ static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
if (uView == LVS_REPORT) if (uView == LVS_REPORT)
{ {
vertInfo.nMax = infoPtr->nItemCount; vertInfo.nMax = infoPtr->nItemCount;
/* scroll by at least one page */
if(vertInfo.nPage < infoPtr->nItemHeight)
vertInfo.nPage = infoPtr->nItemHeight;
vertInfo.nPage /= infoPtr->nItemHeight; vertInfo.nPage /= infoPtr->nItemHeight;
} }
else if (uView != LVS_LIST) /* LVS_ICON, or LVS_SMALLICON */ else if (uView != LVS_LIST) /* LVS_ICON, or LVS_SMALLICON */
...@@ -7144,7 +7170,8 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -7144,7 +7170,8 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
BOOL is_an_icon; BOOL is_an_icon;
TRACE("(nScrollCode=%d, nScrollDiff=%d)\n", nScrollCode, nScrollDiff); TRACE("(nScrollCode=%d(%s), nScrollDiff=%d)\n", nScrollCode,
debugscrollcode(nScrollCode), nScrollDiff);
if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
...@@ -7247,7 +7274,8 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -7247,7 +7274,8 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
INT nOldScrollPos, nNewScrollPos; INT nOldScrollPos, nNewScrollPos;
SCROLLINFO scrollInfo; SCROLLINFO scrollInfo;
TRACE("(nScrollCode=%d, nScrollDiff=%d)\n", nScrollCode, nScrollDiff); TRACE("(nScrollCode=%d(%s), nScrollDiff=%d)\n", nScrollCode,
debugscrollcode(nScrollCode), nScrollDiff);
if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0); if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
...@@ -7257,7 +7285,7 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, ...@@ -7257,7 +7285,7 @@ static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
if (!GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo)) return 1; if (!GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo)) return 1;
nOldScrollPos = scrollInfo.nPos; nOldScrollPos = scrollInfo.nPos;
switch (nScrollCode) switch (nScrollCode)
{ {
case SB_INTERNAL: case SB_INTERNAL:
......
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