GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 29-Jan-2008, 04:59
rag84dec rag84dec is offline
New Member
 
Join Date: Jun 2007
Posts: 14
rag84dec is an unknown quantity at this point

Checkbox in CListCtrl problem


Hi,
I have many check boxes in a list control.My problem is to uncheck the check box if there is a check box already checked.How can i do??..I tried doing the below but it checks the first check box and unchecks the others.

CPP / C++ / C Code:
void SomeClass::OnCheckboxChanged
( NMHDR*                  pNMHeader,
  LRESULT*                pResult )
{
func();
}
bool SomeClass::func
(void)
{
  CListCtrl* a_pStatus = (CListCtrl*) GetDlgItem(IDC_DLG_FWUPDATE);
	OC_ULong_t a_NoChecked=0;
  for(OC_ULong_t  a_Index=0;a_Index<a_pStatus->GetItemCount() ;a_Index++)
  {
    // See if the check was selected
    if(a_pStatus->GetItemState(a_Index,LVIS_STATEIMAGEMASK) == INDEXTOSTATEIMAGEMASK(2))
    {
			a_NoChecked++;
			if(a_NoChecked>1)
				a_pStatus->SetCheck(a_Index,false);
			
    }
  }
	//if(a_NoChecked==1)
    //  return true;
			//else
			//return false;
  return true;
}
Last edited by LuciWiz : 09-Feb-2008 at 05:11. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Graphic problem in Unreal Tournament 2004 zerox Computer Software Forum - Games 10 09-Oct-2005 13:31
Runtime Problem involving "printf" in C Program supamakia C Programming Language 2 09-Oct-2005 11:09
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 08:03
MFC CListCtrl, problem selecting item kte MS Visual C++ / MFC Forum 5 01-Feb-2005 12:15
Please help to solve me a problem with multiline texrbox and checkbox mithila MS Visual C++ / MFC Forum 0 08-Sep-2004 23:08

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:25.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.