1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Checkbox with CListCtrl

Discussion in 'MFC' started by rag84dec, Apr 29, 2008.

  1. rag84dec

    rag84dec New Member

    Joined:
    Jul 17, 2007
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    here is my code
    Code:
    OnCheckboxChanged
    ( NMHDR*                  pNMHeader,
      LRESULT*                pResult )
    {
    	
    	 
    	 CListCtrl* a_pStatus = (CListCtrl*) GetDlgItem(IDC_DLG_FWUPDATE_FILES_LOCALFILES);
    	 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHeader;
    	 LVHITTESTINFO hitinfo; 
    
    //Get the current element item selected.
    	hitinfo.pt = pNMListView->ptAction; 
    
    //Make the hit test... 
    	OC_ULong_t item = a_pStatus->HitTest(&hitinfo); 
    
    	if ((IsChecked(pNMListView->uNewState)))
    		a_pStatus->SetCheck(item,false);
    //*pResult = 0;
      if((IsChecked(pNMListView->uNewState))&&(m_FWInfo.size() != 0))
       GetDlgItem(IDC_BUTTON_DETAILS)->EnableWindow(true);
      else
       GetDlgItem(IDC_BUTTON_DETAILS)->EnableWindow(false);
    
    
    }
    
    
    What is am doing is Enabling the "IDC_BUTTON_DETAILS" button only if one checkbox is set.Can any one tell me other way of doing this?...I want the check box to be set only if mouse is clicked on the checkbox not on the text of the cell which has the check box.... Can anyone please help????
     

Share This Page