I have an application that displays some data from an Excel spreadsheet in a format similar to the multi-column list pictured in your example. Can this control be added to an Excel Userform. If this is possible, it would be very useful to me.
When the control is in "show selection always" state, and previously selected item is being deselected,the item is still shown as selected when the focus is set back to control.
in function SetSel(..) change following line:
if (SetItemState(pos, nState, LVIS_SELECTED|LVS_EX_FULLROWSELECT))
if (SetItemState(pos, nState, LVIS_SELECTED|LVS_EX_FULLROWSELECT|LVIS_FOCUSED))
It becomes an infinite loop in DeleteAllItems() when you feed it only 1 column list. (100% for 1 column)
If I'm saying wrong, please correct me.
I found in 1 column case, actually AddItem() doesn't work well. (items can be added but CMyLParam objects not)
As a result of it, when you do DeleteAllItems(), since the
size of the items > 0, CListCtrl::GetItemCount() is always true. However, since CMyLParam object == NULL (not allocated), CColorListCtrl::DeleteItem(0) does nothing in each time. That way, this becomes an infinite loop.
Here is what I tried to fix it.
[line 206 in ColorListCtrl.cpp]
lvi.iSubItem = 1;
with the following;
if ( columns > 1 ) lvi.iSubItem = 1;
This way, it's working now. In other words, the previous code assumed more than 1 columns, I guess.
Hope this helps somebody who encountered the same situation.