I need to make something like List View in Kaza or like in eMule thet when i click on the header of a column all columns are sorted.
Posted on 2003-06-05 06:15:03 by AceEmbler
LVM_SORTITEMS, you also need comparison procedure, that could just simply call lstrcmp.
Posted on 2003-06-05 08:39:30 by comrade
can i use this stuff to sort by subitems ????
Posted on 2003-06-05 17:32:19 by AceEmbler
Use LVM_SORTITEMSEX, it send the item indexes in the parameters so you can use it for the subitem number: (Code is thrown together pretty quickly so excuse the sloppiness)
SORDER is true or false (Ascending or Descending)
invoke SendMessage,LVHANDLE,LVM_SORTITEMSEX,SORDER,ADDR LVCompareFunc


LVCompareFunc proc lParam1:DWORD,lParam2:DWORD,lParamSort:DWORD
LOCAL TBUFFER1[256] :BYTE
LOCAL TBUFFER2[256] :BYTE
LOCAL ItemData :LV_ITEM

mov eax,lParam1
mov ItemData.iItem,eax

mov eax,LVSORTCOLUMN
mov ItemData.iSubItem,eax

lea eax,TBUFFER1
mov ItemData.pszText,eax

mov ItemData.cchTextMax,255
mov ItemData.imask,LVIF_TEXT

invoke SendMessage,LVHANDLE,LVM_GETITEM,0,ADDR ItemData

mov eax,lParam2
mov ItemData.iItem,eax

mov eax,LVSORTCOLUMN
mov ItemData.iSubItem,eax


lea eax,TBUFFER2
mov ItemData.pszText,eax

mov ItemData.cchTextMax,255
mov ItemData.imask,LVIF_TEXT

invoke SendMessage,LVHANDLE,LVM_GETITEM,0,ADDR ItemData

invoke lstrcmp,ADDR TBUFFER1,ADDR TBUFFER2

.IF lParamSort == FALSE
neg eax
.ENDIF

ret
LVCompareFunc endp
EDIT: cleaned it up a bit. BTW LVSORTCOLUMN
is the column number to be sorted.
Posted on 2003-06-05 18:08:02 by donkey
Wow, I didn't know you could sort items by gender.
Posted on 2003-06-05 18:18:17 by iblis
Also to get the column number from a header click process the LVN_COLUMNCLICK notification:
.ELSEIF uMsg == WM_NOTIFY

mov edx, lParam
.IF [edx].NMHDR.code == LVN_COLUMNCLICK
push [edx].NM_LISTVIEW.iSubItem
pop LVSORTCOLUMN
.ENDIF

etc...
Posted on 2003-06-05 19:13:07 by donkey

Wow, I didn't know you could sort items by gender.
It took me a while to get it but I did. :grin:
Posted on 2003-06-05 19:18:36 by donkey
I don't think LVM_SORTITEMSEX is in Windows.inc, here it is just in case:

LVM_SORTITEMSEX equ LVM_FIRST + 81

This seems to be missing as well...

LVS_EX_BORDERSELECT equ 16384
Posted on 2003-06-05 19:34:37 by donkey