Click here to Skip to main content
       

C / C++ / MFC

 
GeneralRe: can i use mem_fun like this? PinmemberFalconapollo4-Dec-12 14:43 
Questionclient server for running the program Pinmemberdanielsutopo1-Dec-12 15:09 
AnswerRe: client server for running the program PinmemberAlbert Holguin1-Dec-12 17:22 
QuestionLimiting selected checkbox items in a CListCtrl Pinmembersoftwaremonkey1-Dec-12 1:40 
I have a CListCtrl with the LVS_EX_CHECKBOXES style and I want to limit the number of items that the user can select. I have written the following code but (of course) it gets itself in a loop because in changing the state of an item, it causes OnItemchangingLoadingValues() to be called again.
 
void CSpecimenLoadingDialog::OnItemchangingLoadingValues(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	int nCheckedItems = 0;
	for(int i = 0; i < m_loadingVals.GetItemCount(); i++)
	{
		BOOL bState = ListView_GetCheckState(m_loadingVals.m_hWnd, i);
		if(bState)
		{
			nCheckedItems++;
		}
	}
 
	if(nCheckedItems == 2)
	{
		ListView_SetItemState(m_loadingVals.m_hWnd, pNMListView->iItem, FALSE, LVIS_STATEIMAGEMASK);
	}
 
	*pResult = 0;
}
 
What is the correct way to go about doing this? Unsure | :~
SuggestionRe: Limiting selected checkbox items in a CListCtrl PinmemberDavidCrow1-Dec-12 3:51 
AnswerRe: Limiting selected checkbox items in a CListCtrl PinmemberJochen Arndt1-Dec-12 23:56 
GeneralRe: Limiting selected checkbox items in a CListCtrl Pinmembersoftwaremonkey2-Dec-12 22:45 
QuestionUsing VISUAL C++ 6.0 with OLE PinmemberForNow30-Nov-12 9:06 
AnswerRe: Using VISUAL C++ 6.0 with OLE Pinmemberjschell30-Nov-12 10:46 
SuggestionRe: Using VISUAL C++ 6.0 with OLE PinmemberDavidCrow30-Nov-12 14:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 21 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid