How do I prevent unchecked checkboxes in my listview control from disappearing?

Raymond Chen

A customer asked, “I have a listview control in report view with the LVS_EX_CHECK­BOXES extended style. I noticed that unchecked checkboxes are not visible until I hover over the corresponding item. Is it possible to get the checkboxes to be visible all the time?” I was kind of puzzled by this question because the default behavior of the list view control is to show the checkboxes all the time. I could have sat down and written a test program to prove it, but that would have taken too much time, and it wouldn’t have advanced the story any. (The customer would merely have written back, “Well, that’s not what I’m seeing.”) This appeared to be a case of a customer providing incomplete information, forcing me to invoke my psychic powers to fill them in. “My psychic powers tell me that you have also set the LVS_EX_AUTO­CHECK­SELECT extended style. When LVS_EX_AUTO­CHECK­SELECT is set, then unchecked checkboxes are hidden.” Remember, when you ask a question about a component and you have done any customization to that component, please remember to mention that when you ask your question. Otherwise nobody will be able to reproduce your problem, because they will assume you left everything at the defaults. It’s like calling the Ikea customer service line, saying “My Ikea Frusträt rolling cabinet doesn’t roll properly on my hardwood floor when I put more than about 25 pounds of stuff on it.” The person on the phone looks up the specifications for the rolling cabinet and sees that that is well within the design limits. “I paid for you guys to assemble and install it, so it can’t be an assembly or installation error.” The person on the other end scratches their head for a while. And then you mention, “Oh, but I didn’t like the color of the wheels, so I replaced them with some other wheels I bought at Home Depot.”

Oh, yeah, thanks for not mentioning that.


Discussion is closed.

Feedback usabilla icon