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 » Probable bug in dynamic bars Collapse All
Subject Author Date
Gevork Odabashyan Oct 2, 2006 - 9:44 AM

I wrote simple sample that uses dynamic bars. To illustrate my problem, please do the following:
1. Open new dynamic bar ("Create dynamic bar\Bar 1")
2. Set it’s state to "Tabbed document".
3. Switch UI profile to Profile 2 ("Switch Profile\To Profile 2")
4. Switch UI profile to Profile 1 ("Switch Profile\To Profile 1")
There will be no dynamic bar in tabbed state!
The sapmple dynamic_bar_sample.rar was sent to support@prof-uis.com

Technical Support Oct 3, 2006 - 10:59 AM

There were two problems. The first was that you forgot to invoke the parent class method in your project:

void CMyDynamicBar::OnSerializeDynamicProps(CArchive& ar) {
    CExtDynamicControlBar::OnSerializeDynamicProps(ar); // YOU FORGOT THIS
    if ( ar.IsStoring() )
    {
        ar << m_dealDlg.m_id;
    }
    else
    {
        ar >> m_dealDlg.m_id;
    }
}
The second was caused by a typo in Prof-UIS. Please update the source code for the following method:
CExtDynamicControlBar * CExtDynamicBarSite::BarAlloc(
    __EXT_MFC_SAFE_LPCTSTR strCaptionText,
    const CExtCmdIcon & icon,
    UINT nDesiredCmdID, // = 0
    CRuntimeClass * pDesiredRTC, // = NULL
    bool bPersistentBar // = false
    )
{
    ASSERT( this != NULL );
CFrameWnd * pDockSite = DockSiteGet();
    if( pDockSite->GetSafeHwnd() == NULL )
        return NULL;
    ASSERT_VALID( pDockSite );
    ASSERT(
            pDockSite->GetSafeHwnd() != NULL
        &&    ::IsWindow( pDockSite->GetSafeHwnd() )
        );
UINT nCmdID =
        OnDbsAllocNewBarCommandID(
            strCaptionText,
            icon,
            nDesiredCmdID
            );
    if( nCmdID == 0 )
        return NULL;
CExtDynamicControlBar * pBar =
        ( pDesiredRTC != NULL )
            ? ( (CExtDynamicControlBar *) pDesiredRTC->CreateObject() )
            : OnDbsCreateNewBarInstance()
            ;
    pBar->m_bPersistentBar = bPersistentBar;
    if( pBar == NULL )
    {
        OnDbsFreeBarCommandID( nCmdID );
        return NULL;
    }
    ASSERT_VALID( pBar );
    ASSERT_KINDOF( CExtDynamicControlBar, pBar );
    if( ! pBar->Create(
            ( strCaptionText == NULL )
                ? _T("") : strCaptionText,
            pDockSite,
            nCmdID,
            WS_CHILD //|WS_VISIBLE
                |WS_CLIPCHILDREN|WS_CLIPSIBLINGS
                |CBRS_TOP|CBRS_GRIPPER|CBRS_TOOLTIPS
                |CBRS_FLYBY|CBRS_SIZE_DYNAMIC
                |CBRS_HIDE_INPLACE
            )
        )
    {
        OnDbsFreeBarCommandID( nCmdID );
        delete pBar;
        return NULL;
    }
    pBar->m_strCaptionText =
        ( strCaptionText == NULL )
            ? _T("") : strCaptionText;
    pBar->m_icon = icon;
    m_mapBars.SetAt( pBar, NULL );
    pBar->EnableDocking( CBRS_ALIGN_ANY );
    VERIFY(
        pBar->DockControlBarInnerOuter(
            AFX_IDW_DOCKBAR_LEFT,
            true,
            pDockSite,
            false
            )
        );
    pDockSite->ShowControlBar( pBar, FALSE, TRUE );
    return pBar;
}