Dennis Voss
May 19th, 1999, 09:09 AM
Hi,
I now tried several approaches for sorting a listview. All code I've seen on CodeGuru depends on a
derived CListCtrl, but those don't tell me why I have to use it and they don't tell me where and how
I declare/initalise/use/... it ! In the ResourceView window I can simply drop a ListView on a form
and catch the LVN_COLUMNCLICK event. In a multi-column enviroment (which is usually true for
List views) pNMListView->iSubItem has the column to sort for. Now I could use the
m_control_membervar_of_the_listview.GetItemText() and SetItemText() functions to get/set the data
(text in this case) and sort it.
The only problem I have right now it that I don't know which sort is the best one here and how to
implement it. I have tried to do a BubbleSort and a QuickSort. But I failed in doing so.
Please post some code.
Thanks,
Dennis
Dennis Voss
I now tried several approaches for sorting a listview. All code I've seen on CodeGuru depends on a
derived CListCtrl, but those don't tell me why I have to use it and they don't tell me where and how
I declare/initalise/use/... it ! In the ResourceView window I can simply drop a ListView on a form
and catch the LVN_COLUMNCLICK event. In a multi-column enviroment (which is usually true for
List views) pNMListView->iSubItem has the column to sort for. Now I could use the
m_control_membervar_of_the_listview.GetItemText() and SetItemText() functions to get/set the data
(text in this case) and sort it.
The only problem I have right now it that I don't know which sort is the best one here and how to
implement it. I have tried to do a BubbleSort and a QuickSort. But I failed in doing so.
Please post some code.
Thanks,
Dennis
Dennis Voss