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 » Serialization doesn't work correct Collapse All
Subject Author Date
Eugene Wineblat Aug 16, 2006 - 8:16 AM

I have 2 CExtToolControlBar’s on the MainFrame. (m_wndToolBar and m_wndQueryBar)

CMainFrame::OnCreate:

( ... Create m_wndToolBar)
if(    !m_wndToolBar.Create( NULL, this, AFX_IDW_TOOLBAR, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_SIZE_FIXED )
|| !m_wndToolBar.LoadToolBar( IDR_TOOLBAR_TYPICAL ) )
{
TRACE0("Failed to create toolbar\n");
return; // fail to create
}

m_wndToolBar.m_bAppearInDockSiteControlBarPopupMenu = false;
m_wndToolBar.m_bRightButtonDisplayBarsList = false;
m_wndToolBar.g_bToolbarLargeIcons = true;
m_wndToolBar.EnableDocking( CBRS_ALIGN_ANY );

(... Create m_wndQueryBar )
if( !m_wndQueryBar.Create( NULL, this, AFX_IDW_TOOLBAR, WS_CHILD | WS_VISIBLE|CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY )
|| !m_wndQueryBar.LoadToolBar( IDR_TOOLBAR_QUERY ) )
{
TRACE0("Failed to create toolbar\n");
return; // fail to create
}

m_wndQueryBar.m_bAppearInDockSiteControlBarPopupMenu = false;
m_wndQueryBar.m_bRightButtonDisplayBarsList = false;
m_wndQueryBar.g_bToolbarLargeIcons = true;
m_wndQueryBar.EnableDocking( CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM );
....
////Docking
CExtControlBar::FrameEnableDocking(this);

DockControlBar( &m_wndToolBar );
DockControlBar( &m_wndQueryBar );
////Docking
....

I have load serialization section at the end of the CMainFrame::OnCreate:
    CExtControlBar::ProfileBarStateLoad(
        this,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName,
        &m_dataFrameWP
        );

And I have save serialization section in the CMainFrame::DestroyWindow
        CExtControlBar::ProfileBarStateSave(
            this,
            pApp->m_pszRegistryKey,
            pApp->m_pszProfileName,
            pApp->m_pszProfileName,
            &m_dataFrameWP
            )


Problem:
When I place m_wndQueryBar more inner then m_wndToolBar or make m_wndQueryBar floating before I close application, on the next start I always have m_wndQueryBar docked to the top and m_wndToolBar on position where the m_wndQueryBar might be located.
There is no problem if I remove serialization.

Question:
How can I serialize the state of Bars without such "Bar switching"?

Technical Support Aug 16, 2006 - 10:44 AM

Here is your code:

DockControlBar( &m_wndToolBar );
DockControlBar( &m_wndQueryBar );
...
    CExtControlBar::ProfileBarStateLoad(
        this,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName,
        &m_dataFrameWP
        );
If replace that part with
    if( ! CExtControlBar::ProfileBarStateLoad(
            this,
            pApp->m_pszRegistryKey,
            pApp->m_pszProfileName,
            pApp->m_pszProfileName,
            &m_dataFrameWP
            )
        )
    {
        DockControlBar( &m_wndToolBar );
        DockControlBar( &m_wndQueryBar );
        ...
    }
all should work OK.


Eugene Wineblat Aug 16, 2006 - 9:16 AM

Sorry, I have the same constant for both Toolbar AFX_IDW_TOOLBAR...