Print Page | Close Window

Using XML bars customization

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=3653
Printed Date: 10 November 2025 at 1:58am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Using XML bars customization
Posted By: yoavo
Subject: Using XML bars customization
Date Posted: 15 February 2006 at 3:44am

Hi,

In my application I use XML bars customization. I have about 4 DocTemplates and I want to store a different bars layout for each one of them. I prefer to work with one xml file (and make 4 different sections for each DocTemplate). My problem is that it looks like each time I use the method SaveToFile (of CXTPPropExchangeXMLNode), the file is written from scratch, and the previous sections are deleted.

My question is: Can I do it with one XML file with 4 sections, or should I compromise on 4 different XML files for each layout ?

Here is my code (which is called each time a different DocTemplate is load):

CCimString aCustomizationFileName = GetCustomizationFileName();
CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings"));
if (px.OnBeforeExchange())
{
 CXTPPropExchangeSection pxCommandBars(px.GetSection(aStateName));
 XTP_COMMANDBARS_PROPEXCHANGE_PARAM param;
 param.bSerializeControls = TRUE;
 param.bSaveOriginalControls = FALSE;
 mToolBarManager->DoPropExchange(&pxCommandBars, &param);
 px.SaveToFile(aCustomizationFileName);
}

Yoav.

 




Replies:
Posted By: Oleg
Date Posted: 15 February 2006 at 7:53am

Just add

px.LoadFromFile(aCustomizationFileName);

after CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings"));



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


Posted By: yoavo
Date Posted: 01 March 2006 at 6:47am

Hi Oleg,

I tried to follow your instructions but I have some problems with this solusion (I tried to do it also in "Gui_Whidbey" sample and had the same problems as in my App ):

1. The size of the .xml file keeps growing each time I save the layout to the file.

2. The customization does not work OK (if I rename a menu item and run the application again, the renamed name is not restored). I think it happens because the section is not written from scrach and it contains "leftovers" of previous layout saving.

Yoav.



Posted By: yoavo
Date Posted: 02 March 2006 at 2:36am

I also tried it in "Grep" sample (without changing the code) - in this sample you use the same solusion, and the problem exist there too: Try to rename a menu item by customization - it will not be kept, and the .xml file is growing each time you close the application.



Posted By: Oleg
Date Posted: 02 March 2006 at 3:47pm

To solve problem 1:

replace

param.bSaveOriginalControls = FALSE;

to

param.bSaveOriginalControls = TRUE;

 

To solve problem 2:

call

pxCommandBars->EmptySection();

before GetCommandBars()->DoPropExchange(&pxCommandBars, &param);



-------------
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