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 General Discussion » Property grid, accessing the left side Collapse All
Subject Author Date
a a Jun 13, 2006 - 8:08 AM

Hi.

Is it possible to get access to the left side of a property grid? (as cells?) I mean where the properties’ caption are displayed.
If possible, I would like to set a checkbox or to set an icon there.

Thanks.

Technical Support Jun 14, 2006 - 8:58 AM

The CExtPropertyGridCtrl window is a container for one or more CExtPropertyGridWnd-derived tree grid windows. You can enumerate tree grids and find name/value cells of any property item using the following code:

        //
        // That is what we have:
        //
 
CExtPropertyItem * pPropertyItem = . . .
CExtPropertyGridCtrl * pPGC = . . .
 
        //
        // That is what we do:
        //
 
CTypedPtrArray < CPtrArray, CExtPropertyGridWnd * > arrTreeGridWindows;
    pPGC->OnPgcQueryGrids( arrTreeGridWindows );
int nTreeGridCount = int( arrTreeGridWindows.GetSize() );
    for( int nTreeGridIndex = 0; nTreeGridIndex < nTreeGridCount; nTreeGridIndex ++ )
    {
        CExtPropertyGridWnd * pTreeGrid = arrTreeGridWindows.GetAt( nTreeGridIndex );
        HTREEITEM hTreeItem = pTreeGrid->PropertyItemToTreeItem( pPropertyItem );
        if( hTreeItem == NULL )
            continue; // The property item is not inserted into the pTreeGrid tree grid window.
        CExtGridCell * pCellName = NULL, * pCellValue = NULL;
        pCellName = pTreeGrid->ItemGetCell( hTreeItem, 0 );
        if( pPropertyItem->IsKindOf( RUNTIME_CLASS( CExtPropertyValue ) ) )
            pCellValue = pTreeGrid->ItemGetCell( hTreeItem, 1 );
 
        //
        // Now you can modify pCellName and/or pCellValue:
        //
 
        . . .
 
        //
        // If you need to repaint the modified row in pTreeGrid tree grid window:
        //
        LONG nLinearRowNumber = pTreeGrid->ItemGetVisibleIndexOf( hTreeItem );
        if( nLinearRowNumber < 0 )
            continue; // the hTreeItem is under collapsed item in the tree
        CRect rcCellName, rcCellValue;
        if(    (! pTreeGrid->GridCellRectsGet( 0L, nLinearRowNumber, 0, 0, NULL, &rcCellName ) ) 
            || (! pTreeGrid->GridCellRectsGet( 1L, nLinearRowNumber, 0, 0, NULL, &rcCellValue ) )
            )
            continue; // the row is outside the displayer range of rows in the tree grid window
        CRect rcRow( rcCellName.left, rcCellName.top, rcCellValue.right, rcCellName.bottom );
        pTreeGrid->Invalidate( &rcRow );
    }
You can infoke this code in the PropertyStoreSynchronize() virtual method in your CExtPropertyGridCtrl-derived class.