listview: deleting column 0

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Apr 21 14:12:30 CDT 2004


        Huw Davies <huw at codeweavers.com>
        Deleting column zero should only delete the column and not the
        item data.

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.386
diff -u -r1.386 listview.c
--- dlls/comctl32/listview.c	20 Apr 2004 01:12:18 -0000	1.386
+++ dlls/comctl32/listview.c	21 Apr 2004 19:10:33 -0000
@@ -4229,13 +4229,9 @@
            || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
 
     /* While the MSDN specifically says that column zero should not be deleted,
-       it does in fact work on WinNT, and at least one app depends on it. On
-       WinNT, deleting column zero deletes the last column of items but the
-       first header. Since no app will ever depend on that bizarre behavior, 
-       we just delete the last column including the header.
+       what actually happens is that the column itself is deleted but no items or subitems
+       are removed.
      */
-    if (nColumn == 0)
-        nColumn = DPA_GetPtrCount(infoPtr->hdpaColumns) - 1;
 
     LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
     
@@ -4245,15 +4241,12 @@
     Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn));
     DPA_DeletePtr(infoPtr->hdpaColumns, nColumn);
   
-    if (!(infoPtr->dwStyle & LVS_OWNERDATA))
+    if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn)
     {
 	SUBITEM_INFO *lpSubItem, *lpDelItem;
 	HDPA hdpaSubItems;
 	INT nItem, nSubItem, i;
 	
-	if (nColumn == 0)
-	    return LISTVIEW_DeleteAllItems(infoPtr);
-	    
 	for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
 	{
 	    hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem);
@@ -4290,7 +4283,10 @@
     }
 
     /* update the other column info */
-    LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
+    if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
+        LISTVIEW_InvalidateList(infoPtr);
+    else
+        LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
 
     return TRUE;
 }



More information about the wine-patches mailing list