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 » How to load last stored control bar states Collapse All
Subject Author Date
Brian Horn Mar 29, 2007 - 4:49 AM

Hi,



I’m trying to load the saved settings of controlbar and ribbonbar from registry. I wrote code in DestroyWindow() that will store the state of control bar and ribbonbar in registry using CExtControlBar::ProfileBarStateSave, g_CmdManager->SerializeState, g_PaintManager.PaintManagerStateSave, g_CmdManager->ProfileWndRemove, objRibbonbar.CustomizeStateSave. After closing the application DestroyWindow function gets called and it adds values to registry also. But next time when I try to load the application only changed theme gets loaded but application doesn’t load the state of control bar and ribbonbar. I’m sending you the code of CMainFrame::OnCreate() for your reference.



int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

//----------------------------------------------PROF-UIS CODE----SN-----------------------------------

if (CExtNCW < CMDIFrameWnd >::OnCreate(lpCreateStruct) == -1)

return -1;

//----------------------------------------------------------------------------------------------------

CString strOutputWindowName;

strOutputWindowName.LoadString(IDS_OUTPUT_WINDOW_NAME);

if (!m_wndStatusBar.Create(this) ||

!m_wndStatusBar.SetIndicators(indicators,

sizeof(indicators)/sizeof(UINT)))

{

TRACE0("Failed to create status bar\n");

return -1; // fail to create

}



m_wndStatusBar.SetPaneWidth(5,25);

//----------------------------------------------PROF-UIS CODE----SN-----------------------------------



CWinApp* pApp = ::AfxGetApp();

ASSERT( pApp != NULL );



HICON hIcon = pApp->LoadIcon( IDR_MAINFRAME );

ASSERT( hIcon != NULL );

SetIcon( hIcon, TRUE );

SetIcon( hIcon, FALSE );



g_CmdManager->ProfileSetup(

pApp->m_pszProfileName,

GetSafeHwnd()

);



// Create docking Output Window

if( ! CExtControlBar::FrameEnableDocking(this) )

{

ASSERT( FALSE );

return -1;

}



if( ! objRibbonbar.Create(

NULL,

this

)

)

{

TRACE0("Failed to create the m_wndRibbonBar toolbar\n");

return -1; // fail to create

}



objRibbonbar._InitRibbonBar();



BOOL bRibbonVal = objRibbonbar.CustomizeStateLoad(

pApp->m_pszRegistryKey,

pApp->m_pszProfileName,

pApp->m_pszProfileName

);



m_rgbBkColor = m_pWndLabel->GetBkColor();







#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)

if( ! CExtControlBar::FrameInjectAutoHideAreas(this) )

{

ASSERT( FALSE );

return -1;

}

#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)



if(!m_wndOutput.Create(strOutputWindowName,this,IDR_OUTPUTWINDOW))

{

TRACE(_T("Failed to create dialog bar\n"));

return -1;

}



if( ! CExtControlBar::ProfileBarStateLoad(

this,

pApp->m_pszRegistryKey,

pApp->m_pszProfileName,

pApp->m_pszProfileName,

&m_dataFrameWP

)

)

{



/*m_wndOutput.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM ,1,this,false); //AFX_IDW_DOCKBAR_LEFT

ShowControlBar(&m_wndOutput, TRUE, TRUE);*/

m_wndOutput.m_bGripperStaticallyAtTop = false;

DockControlBar( &m_wndOutput, AFX_IDW_DOCKBAR_BOTTOM);

m_wndOutput.EnableDocking( CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);

m_wndOutput.DockControlBar(AFX_IDW_DOCKBAR_BOTTOM ,1,this,false); //AFX_IDW_DOCKBAR_LEFT

ShowControlBar(&m_wndOutput, FALSE, TRUE);

RecalcLayout();

}



g_CmdManager->SerializeState(

pApp->m_pszProfileName,

pApp->m_pszRegistryKey,

pApp->m_pszProfileName,

false

);

return 0;

}

Technical Support Mar 29, 2007 - 11:44 AM

Please let us know the following details:

1) If the registry location parameters in CExtControlBar::ProfileBarStateSave() in CMainFrame::DestroyWindow() and CExtControlBar::ProfileBarStateLoad()in CMainFrame::OnCreate() are the same?


2) What is returned from CExtControlBar::ProfileBarStateLoad() called from CMainFrame::OnCreate()? Do any C++ exceptions occur somewhere inside CExtControlBar::ProfileBarStateLoad()? You can check the latter by enabling the debugger for breaking at any handled/unhandled C++ exceptions