Professional UI Solutions
Site Map   /  Register


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 avoiding sort of categories Collapse All
Subject Author Date
Dominik Braendlin Jul 3, 2008 - 4:20 AM

How can I avoid that the categories are being sorted alphabetically, in the CExtPropertyGridCtrl?

I just want to display them the way I insert them "ItemInsert" in the CExtPropertyStore.


Technical Support Jul 4, 2008 - 1:11 PM

The CExtPropertyGridCtrl window is a container for one or more tree grid windows (CExtPropertyGridWnd-derived). By default two tree grids are created: CExtPropertyGridWndCategorized and CExtPropertyGridWndSorted. Sorting is configured for each tree grid window inside the property grid control by setting its CExtPropertyGridWnd::m_bSortedCategories and CExtPropertyGridWnd::m_bSortedCategories properties (by default both are true). The following code makes all the tree grids displaying both property categories and values "as is" without any sorting:

CExtPropertyGridCtrl * pPGC = ...
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrGrids;
      pPGC->OnPgcQueryGrids( arrGrids );
INT nGridIdx, nGridCount = INT( arrGrids.GetSize() );
      for( nGridIdx = 0; nGridIdx < nGridCount; nGridIdx ++ )
            CExtPropertyGridWnd * pGrid = arrGrids[ nGridIdx ];
            ASSERT_VALID( pGrid );
            pGrid->m_bSortedCategories = false;
            pGrid->CExtPropertyGridWnd::m_bSortedCategories = false;
This code should be invoked before assigning a property store to the property grid control. If pPGC already displays the content of some property store, you can invoke the following code to reload all the tree grids: