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 » CExtPropertyGridCtrl best pratices Collapse All
Subject Author Date
Massimo Germi May 17, 2006 - 4:55 AM

Hi,
I have two simple questions:

1) How to navigate from first to last item, in a CExtPropertyGridCtrl derived class, to get changes?
2) How to handle user selection without derive a class from CExtPropertyGridCell?

tx a lot

Technical Support May 18, 2006 - 3:56 AM

The CExtPropertyGridCtrl window displays the contents of the tree-like data structure that contains CExtPropertyItem objects. The root object is CExtPropertyStore. Others are CExtPropertyCategory and CExtPropertyValue. You can invoke CExtPropertyItem::IsModified() method of any property item to get the flag indicating whether the property item (or any of its children) is modified. To get the property store which is currently displayed in the property grid control, use the CExtPropertyGridWnd::PropertyStoreGet() method. Please note the returned property store may be combined from several other property stores as it is demonstrated in the PropertyGrid and CompoundProperties samples. The property grid control does not create and does not destroy any property store trees. It simply displays the contents of the currently attached property store. So, you should keep your propery store trees for all the configurable objects in your application independently from the property grid control. You can use a CExtPropertyGridCtrl-derived class and override the CExtPropertyGridCtrl::OnPgcInputComplete() and CExtPropertyGridCtrl::OnPgcResetValue() virtual methods to detect two possible events in the property grid when some propery value gets changed. In both methods you have a pointer to the modified propery value and you do not need to traverse the property store tree. You should override the CExtPropertyGridCtrl::RedrawFocusDependentChildren() method to catch the focus change in the active tree grid window. The CExtPropertyGridCtrl window works as a container for one or more CExtPropertyGridWnd tree grid windows and other optional windows. The property grid control automatically synchronizes the focused propery item in active and all inactive tree grid windows to let the user see the same property item focused when switching between tree grids. The CExtPropertyGridCtrl::RedrawFocusDependentChildren() method is invoked when the focus synchronization complete. If you have a pointer to the CExtPropertyGridCtrl window, then you can get a pointer to the focused property item using the following code:

CExtPropertyGridCtrl * pPGC = . . .
CExtPropertyGridWnd * pActiveGrid = pPGC->GetActiveGrid();
 if( pActiveGrid == NULL )
       return ((CExtPropertyItem*)NULL);
HTREEITEM hTreeItem = pActiveGrid->ItemFocusGet();
 if( hTreeItem != NULL )
       return ((CExtPropertyItem*)NULL);
CExtPropertyItem * pPropertyItem =
       pActiveGrid->PropertyItemFromTreeItem( hTreeItem ); 
 return pPropertyItem;