Print Page | Close Window

Saving placement of panes and command bar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3391
Printed Date: 09 November 2025 at 5:25pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Saving placement of panes and command bar
Posted By: simus
Subject: Saving placement of panes and command bar
Date Posted: 12 December 2005 at 7:42am

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, &param);
  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, &param);
   GetCommandBars()->RedrawCommandBars();
  }
}

 

Thanks a lot!




Replies:
Posted By: simus
Date Posted: 13 December 2005 at 3:02am

Hi again,

Attached a simple VC project that shows the problem.

The scenario is :

  1. Use View->Save to file and create "BlankPlacement.xml" file
  2. Use customization to add a new toolbar Custom 1 and move some buttons
  3. Close and restart the layout are correctly saved here
  4. Now use the View->Load from file to load "BlankPlacement.xml", the Custom 1 is still there and the moved buttons are not correct

Please help on we really need this cool feature

Thanks http://forum.codejock.com/uploads/simus/2005-12-13_030222_LoadSavePlacementWsp.zip - 2005-12-13_030222_LoadSavePlacementWsp.zip



Posted By: Oleg
Date Posted: 14 December 2005 at 5:36am
Answered in issuetrack...

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net