|
Hi,
I made functions to load and save the pane layout and command bars
I have a problem with the command bars, sometimes it is ok sometimes not. For instance the placement is sometime loaded only after the 2nd try. Or a same toolbar item that is at pos 1 in a saved file and at pos 10 in a 2nd saved file, after loading sevaral times 1st and 2nd file I have the toolbar item at pos 1 AND 10.
Does anyone see something wrong in the following?
void CMainFrame::SavePlacementToFile(CString filePath){ // Save the layout CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings")); CXTPPropExchangeSection pxLayout(px.GetSection(_T("Layout"))); m_layout->DoPropExchange(&pxLayout);
//Save the command bars XTP_COMMANDBARS_PROPEXCHANGE_PARAM param; param.bSerializeControls=TRUE; param.bSaveOnlyCustomized=TRUE; param.bSerializeImages=TRUE; param.pCommandBars = GetCommandBars();
CXTPPropExchangeSection pxCommandBars(px.GetSection(_T("CommandBars"))); GetCommandBars()->DoPropExchange(&pxComma ndBars, ¶m); px.SaveToFile(filePath); }
void CMainFrame::LoadPlacementFromFile(CString filePath){ CXTPPropExchangeXMLNode px(TRUE, 0, _T("Settings")); if ( px.LoadFromFile(filePath) ){ // Load the pane layout CXTPPropExchangeSection pxLayout(px.GetSection(_T("Layout"))); m_layout->DoPropExchange(&pxLayout) ; m_paneManager.SetLayout(m_layout);
//Load the command bars XTP_COMMANDBARS_PROPEXCHANGE_PARAM param; param.bSerializeControls=TRUE; param.bSaveOnlyCustomized=TRUE; param.bSerializeImages=TRUE; param.pCommandBars = GetCommandBars();
CXTPPropExchangeSection pxCommandBars(px.GetSection(_T("CommandBars"))); GetCommandBars()->DoPropExchange(&pxComma ndBars, ¶m); GetCommandBars()->RedrawCommandBars(); } }
Thanks a lot!
|