简体   繁体   中英

MFC PropertyGrid will not expand on user click (disabled)

I'm actually working with the MFC Property grid and, I wish to allow the user to expand the Items.

Basically I'm adding items to a MFC Property grid

CMFCPropertyGridProperty* mParent = new CMFCPropertyGridProperty(_T("cycle"));
mGrid.AddProperty(mParent);
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("Id"),        _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("Name"),      _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("DateStart"), _T("test")));
mParent->AddSubItem(new CMFCPropertyGridProperty(_T("DateStop"),  _T("test")));

Basically I want all Items to be nonExpanded when I add them but I want the user to be able to expand them However, it seems that the default behavior is to prevent the user from expanding Items...

So far I've tried Enable(true) and EnableActiveAccessibility() but those doesn't seem to work...

Any idea which property I should set?

Thanks!

It's not very obvious, but you need to call CMFCPropertyGridProperty::Expand with the bExpand parameter as FALSE!

Parameters [in] bExpand TRUE to expand the property; FALSE to collapse the property. The default value is TRUE.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM