Listview delete column zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Changelog:
	Support the undocumented behavior of deleting column zero.

Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.340
diff -u -r1.340 listview.c
--- dlls/comctl32/listview.c	12 Feb 2003 21:28:04 -0000	1.340
+++ dlls/comctl32/listview.c	14 Feb 2003 03:38:13 -0000
@@ -4053,7 +4053,17 @@
     
     TRACE("nColumn=%d\n", nColumn);
 
-    if (nColumn <= 0 || nColumn >= infoPtr->hdpaColumns->nItemCount) return FALSE;
+    if (nColumn < 0 || infoPtr->hdpaColumns->nItemCount == 0
+           || nColumn >= infoPtr->hdpaColumns->nItemCount) 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.
+     */
+    if (nColumn == 0)
+        nColumn = infoPtr->hdpaColumns->nItemCount - 1;
 
     LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
     
@@ -4069,6 +4079,9 @@
 	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);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux