Reputation: 59673
I have a CListCtrl with multiple columns, all of which are able to be sorted by. I would like to add up and down icons so that it is clear which column is currently sorted upon, and in which direction; much like Windows Explorer. My thought was to add a solid up/down arrow to the column name. I tried using the extended ASCII chars 30/31; but instead of showing the arrows, I got boxes (the "character not found" character); and using the unicode version, I got a question mark instead of the character.
Any suggestions as to how I could accomplish this?
Upvotes: 3
Views: 2119
Reputation: 51
You can use the newer CMFCListCtrl class or the CMFCHeaderCtrl class. There, you can set the sort column and the sort direction.
Try
myListCtrl.SetSortColumn(nCol, bAscending);
or
CMFCHeaderCtrl &headerCntrl = myListCtrl.GetHeaderCtrl();
headerCntrl.SetSortColumn(nCol, bAscending);
Upvotes: 5