tags:

views:

796

answers:

2

Hello

I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS_EX_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the rows in the control have checkboxes. Is this possible ? If it is how is this done ?

Thanks

Ian

A: 

Yes it is. What you would need to do is to create bitmaps of the check boxes and included those in the call back. One of your bit maps would be blank.

Alternatively, you could do some owner drawing and call the DrawFrameControl function.

You could also add code to test for mouse clicks and respond accordingly.

David L Morris
+4  A: 

For each item which shouldn't have a checkbox:

LVITEM lvi;
lvi.stateMask = LVIS_STATEIMAGEMASK;
lvi.state = INDEXTOSTATEIMAGEMASK(0);
::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi);

To 'create' the check box for an item:

SetCheck(Item, true/false);
Serge - appTranslator
quick Q - clicking the space where the checkbox would be makes one appear, is it me, or a feature of ClistCtrl?
gbjbaanb