CListCtrl  -  set item text as hidden or transparent?

Posted on 2007-07-26
Medium Priority
Last Modified: 2013-11-20

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.

Question by:DJ_AM_Juicebox
LVL 19

Accepted Solution

mrwad99 earned 2000 total points
ID: 19574349
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 ?
LVL 45

Expert Comment

ID: 19574409
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).
LVL 86

Expert Comment

ID: 19574436
Is that text in a separate text box? If so, that would be quite easy.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question