2

Is there a way to enable multiple selection of properties in a CMFCPropertyGridCtrl?

I want to manipulate several CMFCPropertyGridProperty together e.g. for deleting them.

fgrollio
  • 25
  • 1
  • 7

2 Answers2

1

yes you can do that Make column with check box and you can select with corresponding row. you can select multiple row also. make row with check box also.

for(int i=1;i<= Rowcount;i++) {

    GV_ITEM Item;
    Item.mask |= (GVNI_MODIFIED);
    if (!m_Grid.SetCellType(i,CheckColumn, RUNTIME_CLASS(CGridCellCheckCenter)))
        return;
    CGridCellCheckCenter *pCellCheck = (CGridCellCheckCenter*) m_Grid.GetCell(i,CheckColumn);       
    pCellCheck->SetCheck(false);
    pCellCheck = (CGridCellCheckCenter*) m_Grid.GetCell(i,CheckColumn);         
}

then you check the state of row and get the value of that multiple row. you can go through this site also if u needed http://www.codeproject.com/Articles/479/Tree-control-and-Buttons-for-MFC-Grid-control

Preetam Singh
  • 355
  • 1
  • 9
0

No! CMFCPropertyGridCtrl only allows a single selection.

I even have no idea what functionality you want to have with a multiple selection. You can only hit and change only one property. This is the same with the BCG controls.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • I would like to select a lot of them and then hit "delete" to delete them. – fgrollio Oct 30 '13 at 12:49
  • 1
    OK. I understand your intent. But the outer PropertyGrid control only knows one selected item. There is no internal mechanism that allows to select a list. There is only one internal member m_pSel that controls one "selected item". Sorry. You may extent this by subclassing this and using m_pSel only as focused item and add handling of Ctrl+Mouseclick for multiple selections. But it will be a hard work... – xMRi Oct 30 '13 at 13:22
  • Yes, that could be a work around, I just couldn't find an easy way to highlight multiple properties. I think I will go with the "check-boxes option instead" – fgrollio Oct 31 '13 at 09:05