News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Listbox sorted property

Started by jefe, December 30, 2008, 01:24:14 PM

Previous topic - Next topic

jefe

 Do someone know how to set the Listbox property sorted (true or false) .

ragdog

Hi

Read Iczelion tutorials 31

Quote
Sorting items/subitems

You can specify the default sorting order of a listview control by specifying LVS_SORTASCENDING or LVS_SORTDESCENDING styles in CreateWindowEx. These two styles order the items using their labels only. If you want to sort the items in other ways, you need to send LVM_SORTITEMS message to the listview control.

    LVM_SORTITEMS
    wParam = lParamSort
    lParam = pCompareFunction

lParamSort is a user-defined value that will be passed to the compare function. You can use this value in any way you want.
pCompareFunction is the address of the user-defined function that will decide the outcome of the comparison of items in the listview control. The function has the following prototype:

CompareFunc proto lParam1:DWORD, lParam2:DWORD, lParamSort:DWORD

lParam1 and lParam2 are the values in lParam member of LV_ITEM that you specify when you insert the items into the listview control.
lParamSort is the value in wParam you sent with LVM_SORTITEMS

When the listview control receives LVM_SORTITEMS message, it calls the compare function specified in lParam of the message when it needs to ask us for the result of comparison between two items. In short, the comparison function will decide which of the two items sent to it will precede the other. The rule is simple: if the function returns a negative value, the first item (represented by lParam1) should precede the other. If the function returns a positive value, the second item (represented by lParam2) should precede the first one. If both items are equal, it must return zero.
...
..
.

Tedd

Quote from: jefe on December 30, 2008, 01:24:14 PM
Do someone know how to set the Listbox property sorted (true or false) .

How many times do you want to ask the same question? -- http://www.masm32.com/board/index.php?topic=10575.0
No snowflake in an avalanche feels responsible.