CListCtrl  -  set item text as hidden or transparent?

Posted on 2007-07-26
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

    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 43

    Expert Comment

    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

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

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    sumDigits challenge 9 73
    string initialization in java 11 94
    maven archtype selection in eclipse 1 47
    pre4 challenge 19 75
    Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
    Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    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.

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now