SetCheck() for checkbox in MFC GridControl 2.7
-
Im using MFC GridControl 2.7 taken from code proejct in my application.In my grid control, im making second column as check box column. The default state of check box should be true. Later, user can uncheck the checkbox and depends on the state, furthur functinoality wil go. Here i dont know how to set checkbox as checked in default.
m_ctLstCtrl.Create(listRect, this, IDC_TRENDLISTCTRL);
// fill it up with stuff m\_ctLstCtrl.SetEditable(TRUE); try { m\_ctLstCtrl.SetRowCount(9); m\_ctLstCtrl.SetColumnCount(15); m\_ctLstCtrl.SetFixedRowCount(1); m\_ctLstCtrl.SetFixedColumnCount(1); } catch (CMemoryException\* e) { e->ReportError(); e->Delete(); return -1; }
for (int row = 0; row < m_ctLstCtrl.GetRowCount()-1; row++)
{
m_ctLstCtrl.SetCellType(row+1,1,RUNTIME_CLASS(CGridCellCheck));
// m_ctLstCtrl.SetItemState(row+1,1, m_ctLstCtrl.GetItemState(row+1,1) | GVIS_SELECTED); //if i do this, blue colr selection is appearing but not check mark}
Anu
-
Im using MFC GridControl 2.7 taken from code proejct in my application.In my grid control, im making second column as check box column. The default state of check box should be true. Later, user can uncheck the checkbox and depends on the state, furthur functinoality wil go. Here i dont know how to set checkbox as checked in default.
m_ctLstCtrl.Create(listRect, this, IDC_TRENDLISTCTRL);
// fill it up with stuff m\_ctLstCtrl.SetEditable(TRUE); try { m\_ctLstCtrl.SetRowCount(9); m\_ctLstCtrl.SetColumnCount(15); m\_ctLstCtrl.SetFixedRowCount(1); m\_ctLstCtrl.SetFixedColumnCount(1); } catch (CMemoryException\* e) { e->ReportError(); e->Delete(); return -1; }
for (int row = 0; row < m_ctLstCtrl.GetRowCount()-1; row++)
{
m_ctLstCtrl.SetCellType(row+1,1,RUNTIME_CLASS(CGridCellCheck));
// m_ctLstCtrl.SetItemState(row+1,1, m_ctLstCtrl.GetItemState(row+1,1) | GVIS_SELECTED); //if i do this, blue colr selection is appearing but not check mark}
Anu