Implement LVN_ODFINDITEM

Igor Tarasov tarasov.igor at gmail.com
Wed Feb 18 21:26:10 CST 2009


MSDN says that this notification is being sent only in two situations. Both are
implemented.
http://msdn.microsoft.com/en-us/library/bb774735(VS.85).aspx#Handling_virtual_listview_messages

This patch is part of fix for bug #12701:
http://bugs.winehq.org/show_bug.cgi?id=12701
-------------- next part --------------
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 6b89766..af84938 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -106,7 +106,6 @@
  *   -- LVN_GETINFOTIP
  *   -- LVN_HOTTRACK
  *   -- LVN_MARQUEEBEGIN
- *   -- LVN_ODFINDITEM
  *   -- LVN_SETDISPINFO
  *   -- NM_HOVER
  *   -- LVN_BEGINRDRAG
@@ -1574,6 +1573,28 @@ static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, L
         endidx=infoPtr->nItemCount;
         idx=0;
     }
+
+    /* Let application handle this for virtual listview */
+    if (infoPtr->dwStyle & LVS_OWNERDATA)
+    {
+        NMLVFINDITEMW nmlv;
+        LVFINDINFOW lvfi;
+
+        ZeroMemory(&lvfi, sizeof(lvfi));
+        lvfi.flags = (LVFI_WRAP | LVFI_PARTIAL);
+        infoPtr->szSearchParam[infoPtr->nSearchParamLength] = '\0';
+        lvfi.psz = infoPtr->szSearchParam;
+        nmlv.iStart = idx;
+        nmlv.lvfi = lvfi;
+
+        nItem = notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr);
+
+        if (nItem != -1)
+            LISTVIEW_KeySelection(infoPtr, nItem);
+
+        return 0;
+    }
+
     do {
         if (idx == infoPtr->nItemCount) {
             if (endidx == infoPtr->nItemCount || endidx == 0)
@@ -5075,6 +5096,17 @@ static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart,
     POINT Position, Destination;
     LVITEMW lvItem;
 
+    /* Search in virtual listviews should be done by application, not by
+       listview control, so we just send LVN_ODFINDITEMW and return the result */
+    if (infoPtr->dwStyle & LVS_OWNERDATA)
+    {
+        NMLVFINDITEMW nmlv;
+
+        nmlv.iStart = nStart;
+        nmlv.lvfi = *lpFindInfo;
+        return notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr);
+    }
+
     if (!lpFindInfo || nItem < 0) return -1;
     
     lvItem.mask = 0;


More information about the wine-patches mailing list