Checkboxes not working with CListCtrl tile view

51 views
Skip to first unread message

Leo

unread,
Nov 17, 2010, 12:23:21 AM11/17/10
to
I need to create a tile view using CListCtrl with checkbox for each
item. I got two issues:

1) The checkboxes are not reponsive (if I don’t use tile view,
everything is fine);
2) The whole item got selected / focus when I check the checkbox (I
want it work just like the regular checkboxes --- the item itself not
highlighted / focused).

The following is my source code:

DWORD exStyle = m_listCtrl.GetExtendedStyle();
m_ listCtrl.SetExtendedStyle(exStyle | LVS_EX_CHECKBOXES |
LVS_EX_LABELTIP);

// Title info
LVTILEVIEWINFO tvi = {0};
tvi.cbSize = sizeof(tvi);
tvi.dwMask = LVTVIM_COLUMNS;
tvi.cLines = 0;
m_ listCtrl.SetTileViewInfo(&tvi);

m_ listCtrl.DeleteAllItems();
int item = 0;

// Inset list items
String capName;
bool bEnabled = false;
int count = 0;

HashPosition pos = m_capsHash.GetStartPosition();
while (!pos.IsNil())
{
m_capsHash.GetNextAssoc(pos, capName, bEnabled);

count = m_ listCtrl.GetItemCount();
item = m_ listCtrl.InsertItem(count, capName);
ListView_SetCheckState(m_ listCtrl.m_hWnd, item, bEnabled);
}

m_ listCtrl.SetView(LV_VIEW_TILE);

Any idea? Thanks in advance…

Leo

Reply all
Reply to author
Forward
0 new messages