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 » CExtPropertyGridCtrl question Collapse All
Subject Author Date
Marcos Siqueira Jul 27, 2005 - 1:21 PM

Hi,


I have some questions about CExtPropertyGridCtrl component:


1 - How can I set CExtPropertyGridTipBar height ?


2 - How can I determine if properties are in alphabetical ou categorized mode ?


3 - There a way to persist the above settings ?


Thanks


 

Technical Support Jul 28, 2005 - 10:31 AM

To set the height of the tip bar in the property grid control, you should change the height of bar’s window and recompute the control’s layout:

void ChangeTipHeight(
    CExtPropertyGridCtrl & _PGC,
    int nHeightOfTipBar
    )
{
    ASSERT( _PGC.GetSafeHwnd() != NULL );
CWnd * pWnd =
    _PGC.GetChildByRTC(
        RUNTIME_CLASS(
            CExtPropertyGridTipBar
            )
        );
    if( pWnd == NULL )
        return;
CRect rcWnd;
    pWnd->GetWindowRect( &rcWnd );
    if( rcWnd.Height()
            == nHeightOfTipBar
            )
        return;
    pWnd->SetWindowPos(
        NULL,
        0,
        0,
        rcWnd.Width(),
        nHeightOfTipBar,
        SWP_NOACTIVATE
            |SWP_NOMOVE
            |SWP_NOZORDER
            |SWP_NOOWNERZORDER
            |SWP_NOCOPYBITS
        );
    if( (pWnd->GetStyle()&WS_VISIBLE) != 0 )
        _PGC.RecalcLayout();
}
The CExtPropertyGridCtrl window contains one or more CExtPropertyGridWnd windows. By default, it creates CExtPropertyGridWndCategorized and CExtPropertyGridWndSorted windows. So, the following code displays which grid is currently displayed in the property grid control:
CExtPropertyGridCtrl & _PGC = . . .
    . . .
    ASSERT( _PGC.GetSafeHwnd() != NULL );
CWnd * pGridCategorized =
        _PGC.GetChildByRTC(
            RUNTIME_CLASS(
                CExtPropertyGridWndCategorized
                )
            );
    ASSERT_VALID( pGridCategorized );
    if( (pGridCategorized->GetStyle()&WS_VISIBLE) != 0 )
        ::AfxMessageBox( _T("Categorized mode.") );
    else
        ::AfxMessageBox( _T("Sorted mode.") );
You can also use that code to save/restore property grid items. To show the categorized or sorted grid grid, use the following code:
CExtPropertyGridCtrl & _PGC = . . .
    . . .
    ASSERT( _PGC.GetSafeHwnd() != NULL );
    // Show categorized grid
    _PGC.SendMessage( WM_COMMAND, __EXT_MFC_ID_PROPERTY_GRID_CATEGORIZED );

    // Show sorted grid
    _PGC.SendMessage( WM_COMMAND, __EXT_MFC_ID_PROPERTY_GRID_SORTED );