Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Programatically changing value in CExtPropertyGridCtrl Collapse All
Subject Author Date
Patrick Gallagher May 17, 2007 - 7:57 AM

I have a property grid with a category containing CExtGridCellBool cells displayed as check boxes. I want to be able to programatically check all the items in the category or clear the items. I added custom buttons to the property grid toolbar and in my overriden OnCmdMsg handler I do the following to enumerate and check all the items:

CExtPropertyStore* store = PropertyStoreGet();
CExtPropertyItem* myCat = store->ItemGetByName(_T("Category"));

if ( myCat != NULL )
{
int nItems = myCat->ItemGetCount();
for ( int idx = 0; idx < nItems; ++idx )
{
CExtPropertyItem* item = myCat->ItemGetAt( idx );
if ( item != NULL )
{
CExtGridCellBool* pValue =
STATIC_DOWNCAST(
CExtGridCellBool,
item->ValueActiveGetByRTC( RUNTIME_CLASS(CExtGridCellBool) )
);
pValue->DataSet(true);
}
}
}

This does not work. What is the proper way to programatically set the values?

Technical Support May 17, 2007 - 10:42 AM

The CExtPropertyGridCtrl class is designed to be a container for one or more tree grid windows ( CExtPropertyGridWnd-derived classes) displaying the content of the property store. The tree grid windows contain copies of grid cells stored in the property store. When some grid cell changes in the active tree grid window inside the property grid control, then all the grid cells in the in-active tree grid windows and property store get automatically synchronized. If you programmatically change active grid cells in some property values inside the property store, you should finally invoke the CExtPropertyGridCtrl::PropertyStoreSynchronize() method to synchronize all the grid cells in the tree grids.