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 » CExtGridWnd or CExtPropertyGridCtrl with CPropertyPage... Collapse All
Subject Author Date
Il Hwan Jeong May 13, 2006 - 4:13 AM

Let me know. How to use property grid with CPropertyPage.

Additionally, I want to hide CExtPropertyGridComboBoxBar and just read serialized binary data from CFile or memory struct without class defined data.

Is it possible?

Or can i use CExtGridWnd on CPropertyPage

class CPartWizardFeaturePage1 : public CPropertyPage, public CExtPropertyItem::IPropertyItemEnumSite
{
    DECLARE_DYNAMIC(CPartWizardFeaturePage1)

public:
    CPartWizardFeaturePage1();
    virtual ~CPartWizardFeaturePage1();

    enum { IDD = IDD_DIALOG_PROPERTY_PAGE_1 };

protected:
    CExtPropertyStore m_PropertyStoreAll;
    CExtPropertyGridCtrl m_PGC;

    void _CombineMixedStoreAll();

    virtual void DoDataExchange(CDataExchange* pDX);

    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();

    virtual void SetPropertyGridOption(BOOL bState);
    virtual void SetPropertyGridComboBoxState(BOOL bState);
    virtual void SetPropertyGridToolBarState(BOOL bState);
    virtual void SetPropertyGridHelpBarState(BOOL bState);
    virtual void SetPropertyGridWndCategorizedState(BOOL bState);
    virtual void SetPropertyGridWndBackGeoundState(BOOL bState);
    virtual void SetPropertyGridWndTreeBoxState(BOOL bState);
    virtual void SetPropertyGridWndSortedCategoryState(BOOL bState);
    virtual void SetPropertyGridWndFullRowSelectState(BOOL bState);
    virtual void SetPropertyGridWndFilledTreeBoxState(BOOL bState);
    virtual void SetPropertyGridWndSortedValueState(BOOL bState);
    virtual void SetPropertyGridWndGridCellState(BOOL bState);
    virtual void SetPropertyGridWndSortedGridState(BOOL bState);
    virtual void SetPropertyGridWndVBStyleState(BOOL bState);
    virtual void SetPropertyGridWndDrawFocusState(BOOL bState);
    virtual void SetPropertyGridWndBalloonState(BOOL bState);
};

BOOL CPartWizardFeaturePage1::OnInitDialog()
{
    TRACE0("in CPartWizardFeaturePage1::OnInitDialog\n");

    m_PropertyStoreAll.NameSet( _T("Analyzer Options") );

    _CombineMixedStoreAll();

    CExtPropertyGridComboBoxBar * pCombo =
        STATIC_DOWNCAST(
        CExtPropertyGridComboBoxBar,
        m_PGC.GetChildByRTC(
        RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
        )
        );
    ASSERT_VALID( pCombo );
    pCombo->PropertyStoreInsert( &m_PropertyStoreAll );

    SetPropertyGridOption(FALSE);

return TRUE;
}

void CPartWizardFeaturePage1::_CombineMixedStoreAll()
{
    m_PropertyStoreAll.ItemRemove();
    
    //ASSERT_VALID( this );
    //if( m_pPS != NULL )
    //    return m_pPS;

    CExtPropertyStore * pPS = new CExtPropertyStore;

    CExtPropertyCategory * pCategoryLight =
        new CExtPropertyCategory( _T("Lights") );
    //pCategoryWindow->ExpandedSet( false );
    //pCategoryLight->DescriptionSet( _T("Light value") );
    VERIFY( pPS->ItemInsert( pCategoryLight ) );
    /*
pCategoryLight->ItemInsert(
        new CStarButtonProperty_Caption( this )
        );
    pCategoryLight->ItemInsert(
        new CStarButtonProperty_Handle( this )
        );
*/

    m_PropertyStoreAll.Combine( pPS );

    
    CExtPropertyGridComboBoxBar * pCombo =
        STATIC_DOWNCAST(
        CExtPropertyGridComboBoxBar,
        m_PGC.GetChildByRTC(
        RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
        )
        );
    if( pCombo == NULL )
        return;
    ASSERT_VALID( pCombo );
    if( pCombo->GetCurSel() == 1 )
        m_PGC.PropertyStoreSynchronize();
}


Technical Support May 13, 2006 - 12:47 PM

You can certainly use the CExtPropertyGridCtrl window as a child control inside your property page window. Just think about your property page window as though it is a simple dialog window. There are two samples in Prof-UIS where the property grid control is used in the dialog window: PropertyGrid and CompoundProperties. There is a IDD_DIALOG_MAIN dialog template resource in the PropertyGrid sample. The IDC_PROPERTY_GRID_CTRL custom control is used as the property grid control on this dialog. So, insert the same custom control into your property page’s dialog template resource and specify exactly the same properties of the custom control. The CMainDlg class in the PropertyGrid sample application corresponds to the IDD_DIALOG_MAIN dialog template resource. This class is the dialog window, but there is no principal differences between the dialog and the property page. The CMainDlg::m_PGC property is a CExtPropertyGridCtrl window. You should insert the same property into your property page class. Finally, add the following line to the DoDataExchange() virtual method of your property page class as it is done in the CMainDlg::DoDataExchange() method of the PropertyGrid sample:

DDX_Control( pDX, IDC_PROPERTY_GRID_CTRL, m_PGC );
Now you should see the propery grid control created correctly inside your property page window and you can initialize it in the OnInitDialog() method. You should use the following code to hide the combo box bar inside the property grid control:
 
    CExtPropertyGridComboBoxBar * pCombo =
        STATIC_DOWNCAST(
            CExtPropertyGridComboBoxBar,
            m_PGC.GetChildByRTC(
            RUNTIME_CLASS(CExtPropertyGridComboBoxBar)
            )
        );
    ASSERT_VALID( pCombo );
    pCombo->ShowWindow( SW_HIDE );
    m_PGC.RecalcLayout();
It is not necessary to use the collection of property stores and the combo box bar. You can keep one property store and attach it to the property grid control using the following code:
    CExtPropertyStore * pPS = . . .
    m_PGC.PropertyStoreSet( pPS );