[ros-bugs] [Bug 855] Cannot sort by column in Task Manager

ReactOS.Bugzilla at www.reactos.org ReactOS.Bugzilla at www.reactos.org
Thu Jun 18 19:35:29 CEST 2009


http://www.reactos.org/bugzilla/show_bug.cgi?id=855


amine48rz <amine48rz at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
             Status|ASSIGNED                    |NEW

Apal <djapal at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |djapal at gmail.com




--- Comment #3 from Apal <djapal at gmail.com>  2008-04-14 21:30:23 CET ---
I have tried to solve this one but with no success.

    if (pnmh->hwndFrom == hProcessPageListCtrl)
    {
        switch (pnmh->code)
        {
        #if 0
        case LVN_ITEMCHANGED:
            ProcessPageUpdate();
            break;
        #endif
        case LVN_COLUMNCLICK:

             if(pnmv->iSubItem == 1)
             MessageBox(hProcessPage,TEXT("2h sthlh"),TEXT("Test"),MB_OK);
            //if(pnmv->iSubItem == 2)
            // MessageBox(hProcessPage,TEXT("3h sthlh"),TEXT("Test"),MB_OK);    
            // combine sort info into a single value we can send to our sort
function
            (void)ListView_SortItems(hProcessPageListCtrl, CompareListItems,
0);
           break;

.
.
.

with just a dummy compare func just to see some results

int CALLBACK CompareListItems(LPARAM lParam1, LPARAM lParam2, LPARAM
lParamSort)
{
return 1;
}


but I get nothing. I really don't know.
I tried 
if (ListView_SortItems(hProcessPageListCtrl, CompareListItems, 0))
and it always returns false.
I'm not so familiar with win32 api, so does anyone know where is the wrong part
of my code?!


--- Comment #4 from b4dc0d3r <b4dc0d3r at gmail.com>  2008-06-08 04:53:40 CET ---
To enable sorting, I think the PerfDataRefresh() function must sort the data as
it is gathered, partially because the data is live and subject to change.

As an aside, for Apal, ListView_SortItems is not a real function - it is a
macro around SendMessage.  It just sends LVM_SORTITEMS.  So when you use a
dummy compare function, SendMessage indicates success but it really doesn't do
anything.

Anyway, sorting cannot happen the usual way because this page uses
LVM_SETITEMCOUNT to allocate space (including the scrollbar) and then adds data
"on demand".  PerfDataRefresh allocates space for each process and sticks it
all in array pPerfData - then when the ListView needs display information
(LVN_GETDISPINFO) it uses the selected column using ColumnIndex =
pnmdi->item.iSubItem; then calls the relevant PerfDataGet* function using
pnmdi->item.iItem as the Index into the pPerfData struct (MSDN says this is
"Zero-based index of the item to which this structure refers.")

So data should be gathered, then sorted the proper way (maybe using one var for
selected column and one for asc/desc order, which are changed by HDN_ITEMCLICK
followed by SetEvent() to refresh the data immediately).  This way the sort
happens once, each refresh.

I may or may not do this myself, but wanted to at least record what I found for
now.


--- Comment #5 from maximevernier <maximevernier at gmail.com>  2009-06-18 19:35:29 CET ---
Created an attachment (id=4084)
 --> (http://www.reactos.org/bugzilla/attachment.cgi?id=4084)
Sort process list by clicking on any column


-- 
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the Ros-bugs mailing list