CListCtrl not maintaining highlight after deleting previous row 
Author Message
 CListCtrl not maintaining highlight after deleting previous row

I'm trying to remove several items programatically from a list control
whenever a user selects a specific item.  I want the selected item to
remain selected and maintain focus.

For example: if they select the 6th item, then I want to remove the 4
items above the 6th item and I want the item that I originally
selected (6th item now the 2nd item) to remain selected and maintain
the focus.

void CLstCtrlHideShowTestDlg::OnItemchangedList1(NMHDR* pNMHDR,
        LRESULT* pResult)
 bool bOldSelected = (bool)(pNMListView->uOldState & LVIS_SELECTED);
 bool bNewSelected = (bool)(pNMListView->uNewState & LVIS_SELECTED );

 if (bNewSelected && !bOldSelected)
    if(pNMListView->iItem == 5)
     // simulate collapse


The 6th item is now the 2nd item in the list and it correctly has the
focus rectangle but it is not selected.  However, if I use the
keyboard instead of the mouse, everything works correctly.

I've tried using SetItemState and SetFocus but still not working.
Does the
DeleteItem remove the selection mask after it is complete?  Is the
NM_CLICK doing something even though I haven't overriden this

Any suggestions appreciated.

Tue, 13 Sep 2005 16:16:09 GMT  
 [ 1 post ] 

 Relevant Pages 

1. CListCtrl and Row highlighting

2. CListCtrl - How to select / highlight a row in Listctrl view

3. Highlight a complete row in CListCtrl

4. Programatically Highlighting A Row In A CListCtrl

5. CListCtrl - Highlight a row

6. Help: Highlight the whole row of a CListCtrl

7. CListCtrl Row Highlight disappears when control loses focus

8. Select (or highlight) the whole row in the CListCtrl

9. Highlight first row of a CListCtrl?

10. CListCtrl and entire row highlighting.

11. Clistctrl: highlight a whole row

12. Wizard CListCtrl item not correctly highlighted


Powered by phpBB® Forum Software