Professional UI Solutions
Site Map   /  Register
 
 
 

Property Grid

How to turn on/off sorting for category and property names in the property grid?

The CExtPropertyGridCtrl control is implemented as a container for one or more CExtPropertyGridWnd tree grid controls, which are used for displaying property values and, optionally, property categories. You can configure each tree grid in such a way that its property values and/or property categories are either sorted or go in the order in which you inserted them into the grid.

First get the tree grids created in the property grid:

CExtPropertyGridCtrl * pPGC = . . .
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
            pPGC->OnPgcQueryGrids( arrGrids );

Second specify the sort options for each tree grid:

bool bSortedCategories = . . .
bool bSortedValues = . . .
            for( ; nGridIdx < arrGrids.GetSize(); nGridIdx ++ )
            {
                        CExtPropertyGridWnd * pPGW = arrGrids[ nGridIdx ];
                        ASSERT_VALID( pPGW );
                        pPGW->m_bSortedCategories =  bSortedCategories;
                        pPGW->m_bSortedValues =  bSortedValues;
            }

If the code above is invoked before assigning a property store to the property grid, the task is complete. If a property store is already assigned and its content is loaded into the tree grid controls, you should use the CExtPropertyGridCtrl::PropertyStoreSynchronize() method for refresh the tree grids because their sort options have changed.

How to implement a property grid without the top combo box?

There are two ways doing this. The first is to call CExtPropertyGridCtrl::GetChildByRTC() in order to get a pointer to the CExtPropertyGridComboBoxBar window, hide it and finally call CExtPropertyGridCtrl::RecalcLayout(). The second is to override the OnPgcCreateBars() method in a CExtPropertyGridCtrl-derived class so the new method is the same as the original one except for the CExtPropertyGridComboBoxBar window that should not be created in it.

How can I know when the user expands or collapses a category in the property grid control?

The categorized grid (CExtPropertyGridWndCategorized) in the property grid (CExtPropertyGridCtrl) is derived from the CExtTreeGridWnd class, which has a CExtTreeGridWnd::ItemExpand() virtual method that is invoked when an item with sub items is expanded or collapsed:

virtual void ItemExpand(
   HTREEITEM hTreeItem,
   INT nActionTVE = TVE_TOGGLE,
   bool bRedraw = true
);

You can override the CExtPropertyGridCtrl::OnPgcCreateGrids() virtual method in order to create a CExtPropertyGridWndCategorized-derived property grid in which the CExtTreeGridWnd::ItemExpand() virtual method is overridden (do to forget to call the ItemExpand() method of the base class).

You may also need to make a conversion between handles to HTREEITEM items of the tree grid and pointers to CExtPropertyItem items of the property grid. You can use the CExtPropertyGridWnd::PropertyItemToTreeItem() and CExtPropertyGridWnd::PropertyItemFromTreeItem() methods for that.

What is the Prof-UIS property grid?

The Prof-UIS property grid is a set of C++ classes that allows you implement a modern, feature-rich Visual Studio .Net like property grid window for browsing and editing properties of objects of any complexity.

What is the combine operation with regard to the property grid?

The Prof-UIS property grid features displaying and editing properties of more than one object. Each object has its own tree of properties that is described by its property store (the CExtPropertyStore class). You can create a separate instance of CExtPropertyStore and combine properties of several objects in it so that you can subsequently display the combined property store in the property grid:
m_PropertyStoreCompoundSelection.Combine( m_wndStatic1.GetPropertyStore() );
m_PropertyStoreCompoundSelection.Combine( m_wndStatic2.GetPropertyStore() );
m_PropertyGrid.PropertyStoreSet(m_PropertyStoreCompoundSelection );
m_PropertyGrid.PropertyStoreSynchronize();

Is it possible to use the Prof-UIS property grid as a control in a MFC project that does not use other Prof-UIS controls?

Yes, you can use the Prof-UIS property grid as a standalone control.

If you have any questions, please visit our forum or contact our technical support team at support@prof-uis.com.