To make check boxes act like radio buttons (mutually exclusive)
Posted
by Praveen S. Kumar
on February 1st, 1999
void CListDlg::OnItemchangedMylist(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
/* If the event is not fired because of any change in individual items then the oldstate and
newstate members of pNMListView are not used. So check for that.*/
if (!pNMListView->uOldState && !pNMListView->uNewState)
return;
// m_listctl is the member variable of the dialog which is of type CListCtl.
BOOL bChecked = ListView_GetCheckState(m_listctl.m_hWnd, pNMListView->iItem);
// if it's checked uncheck everything else.
int nCount;
if (bChecked)
for(nCount=0;nCount<m_listctl.GetItemCount();nCount++)
if(nCount != pNMListView->iItem)
m_listctl.SetCheck(nCount, FALSE);
}
Date Last Update: February 1, 1999

Comments
hello
Posted by tzjtzjtzj on 04/13/2013 10:41amgood
ReplyI want partly checkbox in one column
Posted by Legacy on 03/29/2003 12:00amOriginally posted by: sandmanq
ReplyHow to disable clicking checkboxes
Posted by Legacy on 12/21/2001 12:00amOriginally posted by: osl
ReplyAnother possibility
Posted by Legacy on 12/05/2001 12:00amOriginally posted by: Radu
ReplyEx(Properties)List
Posted by Legacy on 10/07/2001 12:00amOriginally posted by: Mike Philis
ReplyHow to disable clicking the CheckBox?
Posted by Legacy on 05/15/2001 12:00amOriginally posted by: Reichrath
-
ReplyChange picture index connected with this item to 0
Posted by SzadQ on 06/01/2004 12:10pmChange picture index connected with this item to 0
ReplyCheckbox control in a ListCtrl?
Posted by Legacy on 08/24/2000 12:00amOriginally posted by: William Wacholtz
Is it possible to disable a single row in a listctrl that has a checkbox checked? If it is, how?
ReplySetCheck?
Posted by Legacy on 04/10/1999 12:00amOriginally posted by: Andrei Korobkov
SetCheck function is not a member of CListCtrl...
Reply