CListCtrl - set item text as hidden or transparent?


Is there a way with a CListCtrl to set the state of a particular item so that its text is transparent or hidden?

I have a CListCtrl that implements sorting based on the text in the cells. In my first column, I put check mark boxes so sorting doesn't work for it. I was thinking I could just place a "1" or "0" for the text in those cells and then sorting will work, but I'd like the "1" or "0" to be hidden from the user.

Who is Participating?
mrwad99Connect With a Mentor Commented:
The easiest way to achieve what you are after is to associate data with each entry in the list, then use this as a means for sorting.  Do this via CListCtrl::SetItemData.  The data you set could simply be an integer, then you could retrieve the data with CListCtrl::SetItemData and sort based on the value.

Does this help, or have I misunderstood you ?
AndyAinscowFreelance programmer / ConsultantCommented:
You already know if the item is checked or not (else how do you set it as checked).  So if you want to sort on column zero (for example that column has the check boxs) then you don't use the text in that column - you use the state (checked or not).
Is that text in a separate text box? If so, that would be quite easy.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.