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 » CExtControlBar assert when restoring state Collapse All
Subject Author Date
Jeremy Richards Feb 21, 2008 - 12:10 PM

I am modifying an existing application that used docking windows to use the Prof-UIS CExtControlBar for added functionality.

Unfortunately, whenever I try to restore the bar’s states from the registry, I get an assert in void CExtControlBar::InternalDockStateBar::StateSet. The assert is at line 4960:
#ifdef _DEBUG
        INT nRealDockedCount =
            ((CExtDynControlBar *)m_pHelperBar)
                -> m_pWndDynDocker
                -> GetDockedCount();
        ASSERT( nRealDockedCount == nCount );
#endif // _DEBUG

The code I am using to restore is (and very similar code to save):
    CWinApp *pApp = AfxGetApp();
    CExtControlBar::ProfileBarStateLoad(
        theFrame,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        profName,
        NULL
    );

Now, I have successfully used this with some of the app wizard generated apps, so I am guessing that I have not initialized something properly. I was wondering if anyone had any tips on what might be causing this.

Technical Support Feb 25, 2008 - 4:30 AM

All the control bars created by your code in scope of one frame window must have unique identifiers. This is an essential requirement for both MFC and Prof-UIS subsystems related to control bars. The state loading may fail in both MFC and Prof-UIS if some control bars have duplicated identifiers.

Technical Support Feb 22, 2008 - 2:31 AM

You cannot used both dockable MFC control bars and Prof-UIS control bars in one project. Please also make sure that you cleared the registry entry which keeps the control bar state.

Jeremy Richards Feb 22, 2008 - 9:56 AM

I figured out the problem. I was giving all of the control bars an ID of AFX_IDW_DIALOGBAR. This doesn’t cause any apparent errors or problems UNTIL you try to save/load, then it breaks big time. Presumably Prof-UIS is trying to apply the saved state of every control bar to the first one created, which causes it to get confused.

It might be worthwhile in debug mode to add an ASSERT if a user attempts to create two control bars with the same ID, as at first blush the results can appear fine, and only fail later.

Jeremy Richards Feb 22, 2008 - 9:03 AM

I have converted all docking windows to the CExtControlBars. I am not try to mix and match in one workspace. The Menus remain old style CMenus (firmly attached to the frame and undockable). Not sure if that would be related to the problem.