Setting Current Row in a CListCtrl
Posted on 2009-05-11
I have a CListCtrl that uses a virtual list with user drawn data allowing for mulitple selections.
When the user clicks on a header, the logic changes the sort order and re-sorts the data.
What is working great is the logic that first records which items are currently selected, resorts the list, and reselects the selected items even though they have moved positions.
But what else is happening to me is the "current" item does not change.
As an example, say I have a List where Item #2 is selected. If I hit the down arrow, the list changes the selected item to #3. If I click a header and resort the data, what was item #3 is not item #7, and item #7 is selected (by virtue of the item highlighted in blue). But item #3 still has a dash rectangle around it, and if I hit the down arrow, item #4 becomes selected rather than #8.
I am NOT using Hot cursors. Based on the documentation, I would have thought CListCtrl::SetSelectionMark would allow me to update which item that dash rectangle would apper. But when I tried hard coding the selection mark to say item #2, the dash rectangle didn't move.
So what do I need to call to move that dash rectangle?