|
Question : CListCtrl Why is SetSelectionMark() not working
|
|
The CListCtrl has 10 items in it. First item in the list is clicked on and selected (index for item is 0 ). Code needs to change that selection to item 4
m_List.SetSelectionMark( 3 ); // does nothing
int Sel = m_List.GetSelectionMark(); // return 0 so the selection is still the first item
I tried: m_List.UpdateData(TRUE); // does not move the selection highlight m_List.UpdateWindow(); // does not move the selection highlight
I tried: ::PostMessage( m_List.m_hWnd, LVM_SETSELECTIONMARK, 0, (LPARAM) 3); // does nothing item 0 is still selected.
I tried:
m_List.SetItemState( 3, LVIS_FOCUSED | LVIS_SELECTED, LVIF_STATE); // does nothing item 0 is still selected.
What in the world must I do to change the selection.
|
|
Answer : CListCtrl Why is SetSelectionMark() not working
|
|
Sorry, try
m_list.SetSelectionMark(nItem); m_list.SetItemState(nItem, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
|
|
|
|