Keith G
Keith G

Reputation: 4560

MFC - How can I disable a list item?

I have a CListCtrl with checkboxes. I want to be able to disable one of the items so that the user cannot click the checkbox. Is this possible? If so, how?

Edit: Found the specifics on how to hide a checkbox in another question Need only some rows in a CListCtrl control to have check boxes

Upvotes: 2

Views: 4897

Answers (1)

arul
arul

Reputation: 14084

Shortly: Not easily possible.

You'll need to sub-class the CListCtrl and implement this behavior on your own or download for example the MFC Grid Control that allows you to do that.

As for the removing check-boxes idea, yes, that might be possible, MSDN:

Version 4.70. Enables check boxes for items in a list-view control. When set to this style, the control creates and sets a state image list with two images using DrawFrameControl. State image 1 is the unchecked box, and state image 2 is the checked box. Setting the state image to zero removes the check box.

Upvotes: 5

Related Questions