in your external array that could be used to go back to that sort order.
typically based on one of the columns (like Filename for example).
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message
news:iqr743tuc8u8flr1npvtr8qoskssdmu8fv@4ax.com...
The SortItems callback gets only the ItemData of the entries, so it *is*
required for
sorting.
Yes, that is so. While verifying this, I looked at some old code that
supports sorting a ListCtrl by clicking the various column headers in
Report view. In addition, it also supports the user specifying a native
order by moving rows up and down to a desired location. I call this the
"unsorted" order because it is the default order of the items when no
column header is clicked. The user can also restore this order by
clicking a "Show unsorted" button as well.
Preserving the unsorted order (so it can be later restored) requires some
external storage, since the ListCtrl is not capable of saving multiple
orderings. I chose to create an external array containing each row's item
data, saved in the unsorted order. Not only did this provide the unsorted
order, but it provided one place to save the list data (thus the array is
like a CDocument and the ListCtrl was the view). The ItemData of the
ListCtrl is the index into this external array of the row's data. Maybe
this is what the OP wants, though I agree if the unsorted ordering was not
required, it is far easier to simply store the data in the ItemData of the
list itself.
-- David