CListCtrl row selection
-
Hi guys, I am developing a dialog based application and CListCtrl is one of its controls. I have selected the check box style for clistctrl. What i want is when user clicks a check box in ListCtrl, that row should be selected. When user selects another check box, selection should be on that row. Please help me by giving some source code. Thanks in Advance Velayudhan
-
Hi guys, I am developing a dialog based application and CListCtrl is one of its controls. I have selected the check box style for clistctrl. What i want is when user clicks a check box in ListCtrl, that row should be selected. When user selects another check box, selection should be on that row. Please help me by giving some source code. Thanks in Advance Velayudhan
Use "SetSelectionMark" member function of CListCtrl class
-
Use "SetSelectionMark" member function of CListCtrl class
thanks, but my question, how do i know currently which check box has been clicked ?
-
thanks, but my question, how do i know currently which check box has been clicked ?
Use "GetHotItem( )" function of CListCtrl class.
-
Hi guys, I am developing a dialog based application and CListCtrl is one of its controls. I have selected the check box style for clistctrl. What i want is when user clicks a check box in ListCtrl, that row should be selected. When user selects another check box, selection should be on that row. Please help me by giving some source code. Thanks in Advance Velayudhan
Hello, here is something what can be helpful? First you have to catch the OnClick() Event, and save the previous and current selection! This is what works:
CMyDialog::OnClickList(NMHDR* pNMHDR, LRESULT* pResult) { // iSelectionCurrent and iSelectionOld are members from my dialog: iSelectionCurrent = m_cListResults.GetSelectionMark(); // ok, take a current selection! if(iSelectionOld == -1) { // if my old selection is less then 0, // that means i never select something before, // ok, then save the current selection for the first time! iSelectionOld = iSelectionCurrent; // here } else { // else, i select an item before, so is iSelectionOld >= 0! m_cListResults.SetCheck(iSelectionOld, FALSE); // ok, lets uncheck the previous selection iSelectionOld = iSelectionCurrent; // save the current selection! // this is the same: // iSelectionOld = m_cListResults.GetSelectionMark(); } m_cListResults.SetCheck(m_cListResults.GetSelectionMark(), TRUE); // and check the new selected item(Row) *pResult = 0; }
regards break; -- modified at 4:54 Thursday 12th October, 2006