sorting listview by clicking header

Duane Clark junkmail at junkmail.com
Wed Mar 6 17:56:08 CST 2002


matty i wrote:
> thanks to all of the great work that has been done to listview, my app
> is finally readable.  cudos on the latest patch that fixed up text
> (that was getting truncated), it's correct this time around.  anyways,
> the one thing missing to get my app working is column sorting (done by
> clicking a header).  i have below the output from a
> "trace+listview,trace+header" run of the app, clipped just to the
> click on the header.

Here is a fix (take 2) for the header sorting. I will submit it to 
wine-patches when Alexandre finishes his changes and starts committing 
to CVS again.

-- 
My real email is akamail.com at dclark (or something like that).
-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.122
diff -u -r1.122 listview.c
--- dlls/comctl32/listview.c	2002/02/28 21:42:25	1.122
+++ dlls/comctl32/listview.c	2002/03/06 23:49:41
@@ -929,9 +935,6 @@
   if ((LVS_TYPESTYLEMASK & lStyle) == LVS_NOSCROLL)
     FIXME("  LVS_NOSCROLL\n");
 
-  if ((LVS_TYPESTYLEMASK & lStyle) == LVS_NOSORTHEADER)
-    FIXME("  LVS_NOSORTHEADER\n");
-
   if (lStyle & LVS_EDITLABELS)
     FIXME("  LVS_EDITLABELS\n");
 
@@ -7971,9 +7994,9 @@
   
   /* create header */
   infoPtr->hwndHeader =	CreateWindowW(WC_HEADERW, (LPCWSTR)NULL, 
-                                      WS_CHILD | HDS_HORZ | HDS_BUTTONS, 
-                                      0, 0, 0, 0, hwnd, (HMENU)0, 
-                                      lpcs->hInstance, NULL);
+    WS_CHILD | (DWORD)((LVS_NOSORTHEADER & lpcs->style)?HDS_HORZ:HDS_BUTTONS), 
+    0, 0, 0, 0, hwnd, (HMENU)0, 
+    lpcs->hInstance, NULL);
 
   /* set header font */
   SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, 
@@ -8770,7 +8793,7 @@
       infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
       InvalidateRect(hwnd, NULL, TRUE);
     }
-    else if(lpnmh->code ==  HDN_ITEMCLICKW)
+    else if(lpnmh->code ==  HDN_ITEMCLICKW || lpnmh->code ==  HDN_ITEMCLICKA)
     {
         /* Handle sorting by Header Column */
         NMLISTVIEW nmlv;


More information about the wine-users mailing list