ListView fix

François Gouget fgouget at codeweavers.com
Fri Mar 2 17:54:53 CST 2001


   This fixes two bugs:
 - first if nSelectionMark is -1 then we should not select everything
between -1 and nItem. Especially for the -1 item!!!
 - second, in LISTVIEW_SetGroupSelection, if nSelectionMark is not set,
then it should be set to the current item

   You can check all this using the ListView program from the ControlSpy
test suite.


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * dlls/comctl32/listview.c

   In LISTVIEW_AddGroupSelection and LISTVIEW_SetGroupSelection, if no
selection mark has been set, just select the current item
   In LISTVIEW_SetGroupSelection we must also set the selection mark in
that case (and only in that case)

-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/cvs/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.99
diff -u -r1.99 listview.c
--- dlls/comctl32/listview.c	2001/02/28 05:31:02	1.99
+++ dlls/comctl32/listview.c	2001/03/02 23:32:51
@@ -1538,6 +1538,9 @@
   INT i;
   LVITEMA item;
 
+  if (nFirst == -1)
+    nFirst = nItem;
+
   ZeroMemory(&item,sizeof(LVITEMA));
   item.stateMask = LVIS_SELECTED;
   item.state = LVIS_SELECTED;
@@ -1679,8 +1692,17 @@
   if ((uView == LVS_LIST) || (uView == LVS_REPORT))
   {
     INT i;
-    INT nFirst = min(infoPtr->nSelectionMark, nItem);
-    INT nLast = max(infoPtr->nSelectionMark, nItem);
+    INT nFirst, nLast;
+
+    if (infoPtr->nSelectionMark == -1)
+    {
+      infoPtr->nSelectionMark = nFirst = nLast = nItem;
+    }
+    else
+    {
+      nFirst = min(infoPtr->nSelectionMark, nItem);
+      nLast = max(infoPtr->nSelectionMark, nItem);
+    }
 
     for (i = 0; i <= GETITEMCOUNT(infoPtr); i++)
     {


More information about the wine-patches mailing list