LISTVIEW_SetItemCount without LVS_OWNERDATA

Duane Clark dclark at akamail.com
Sun Feb 2 16:46:52 CST 2003


This fixes the bug reported by Dan Kegel in
Re: App works almost perfectly, but one MDI screen won't draw

Changelog:
	Implement LISTVIEW_SetItemCount without LVS_OWNERDATA

-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.338
diff -u -r1.338 listview.c
--- dlls/comctl32/listview.c	24 Jan 2003 00:54:59 -0000	1.338
+++ dlls/comctl32/listview.c	2 Feb 2003 22:41:22 -0000
@@ -6657,13 +6657,24 @@
     }
     else
     {
-	/* According to MSDN for non-LVS_OWNERDATA this is just
-	 * a performance issue. The control allocates its internal
-	 * data structures for the number of items specified. It
-	 * cuts down on the number of memory allocations. Therefore
-	 * we will just issue a WARN here
-	 */
-	WARN("for non-ownerdata performance option not implemented.\n");
+        HDPA hdpaSubItems;
+        ITEM_INFO *lpItem;
+        int i;
+        
+        for (i=0; i<nItems; i++)
+        {
+            if ( !(lpItem = (ITEM_INFO *)COMCTL32_Alloc(sizeof(ITEM_INFO))) )
+	        return 0;
+            
+            /* insert item in listview control data structure */
+            if ( (hdpaSubItems = DPA_Create(8)) )
+            {
+                if ( !DPA_SetPtr(hdpaSubItems, 0, lpItem) ) assert (FALSE);
+            
+                DPA_InsertPtr( infoPtr->hdpaItems, i, hdpaSubItems );
+            }
+        }
+        infoPtr->nItemCount = nItems;
     }
 
     return TRUE;


More information about the wine-patches mailing list