And this is what I have to select or unselect items when they are either
AliR.
You have to manage the checkbox yourself. This is some code I use:
void CMyDlg::OnNMClickList(NMHDR *pNMHDR, LRESULT *pResult)
{
NMLISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
LVHITTESTINFO hitinfo;
//Copy click point
hitinfo.pt = pNMListView->ptAction;
//Make the hit test...
int item = m_cList.HitTest(&hitinfo);
*pResult = 0;
if(item != -1) {
//We hit one item... did we hit state image (check box)?
//This test only works if we are in list or report mode.
if( (hitinfo.flags & LVHT_ONITEMSTATEICON) != 0) {
BOOL bChecked = !m_cList.GetCheck(item);
m_cList.SetCheck(item,bChecked);
}
}
http://www.codersource.net/mfc_clistctrl_checkbox.html
Tom
"kathy" <yqin_99@yahoo.com> wrote in message
news:1156790194.078868.131070@74g2000cwt.googlegroups.com...
I have set the style:
m_ListCtrl.SetExtendedStyle( LVS_EX_GRIDLINES | LVS_EX_CHECKBOXES );
What I want to get is:
1. when one item is selected, the check box should be checked; If one
item is not selected, it should be unchecked.
2. If item is checked, it should be selected; if not checked, it should
be unselected.
How to do that?