visual-c++mfcclistctrl

MFC VC++: How to keep focus mark or selection mark when CListCtrl does not have focus


I have 2 List controls side by side in my view area. When I select an item in list1, the list2 is populated. When an item is selected in list2, details are displayed in another view besides it.

So when an item is selected in list2, list1 looses its selected state and focused states(markers).

How to keep the item highlight in list1 after focus is moved away?


Solution

  • When constructing the List View control, specify the LVS_SHOWSELALWAYS list-view window style. The effect is that

    The selection, if any, is always shown, even if the control does not have the focus.