Print Page | Close Window

SaveStateToString/LoadStateFromString

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=9633
Printed Date: 08 October 2024 at 8:40am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: SaveStateToString/LoadStateFromString
Posted By: cgaskill
Subject: SaveStateToString/LoadStateFromString
Date Posted: 19 February 2008 at 2:59pm
I am having an issue with the SaveStateToString/LoadStateFromString methods.  The string is saved to/loaded from a database.  The calls are being made as follows:

sLayout = Me.CommandBars.SaveStateToString(True, True, True)

Call Me.CommandBars.LoadStateFromString(sLayout, True, True)

I am on version 9.7.  The designer is not used.  We create the menu & toolbary at runtime.  After the menu & toolbar have been created we load the layout string (if applicable) to restore any customizations done.

Here is the scenario:

1) 'Fresh Start - No Customization Done
LOAD CommandBarLayout Size = 0
SAVE CommandBarLayout Size = 14768

2) 'Reload after No Customization Done, Still No Customization Done
LOAD CommandBarLayout Size = 14768
SAVE CommandBarLayout Size = 680

3) 'Reload after Still No Customization Done - Remove some items from toolbar
LOAD CommandBarLayout Size = 680
SAVE CommandBarLayout Size = 14396

4) 'Reload afer Remove some items from toolbar - Loads OK - No More Customization Done
LOAD CommandBarLayout Size = 14396
SAVE CommandBarLayout Size = 680

5) 'Reload after No More Customization Done - Lost Customization from Step 3
LOAD CommandBarLayout Size = 680
SAVE CommandBarLayout Size = 14768

As you can see, when we closed the application the 2nd time still making no changes to the original layout loaded in step 1 the size is much smaller.

Then the 3rd time we go in, we make some changes and we we go back in in step 4 those changes are kept; however, when we close the application the 4th time (making not additional changes from when we went in the 3rd time) the size is much smaller (not the same size as when we made the changes and closed in step 3).

Therefore, when we load again in step 5 our changes are lost.

Any thoughts and what I am doing wrong here?

Thanks.




Replies:
Posted By: Oleg
Date Posted: 20 February 2008 at 1:58pm
Hi,
9.7 version is too old, Try to check it with last eval version.


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


Posted By: cgaskill
Date Posted: 20 February 2008 at 6:19pm
Same result.


Posted By: Oleg
Date Posted: 21 February 2008 at 1:29am
Hi,
 
We need some sample to debug it.


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


Posted By: cgaskill
Date Posted: 21 February 2008 at 10:02am
Here is a test app that shows how I am using the CommandBars control.  To replicate issue do the following.

1) Launch App
2) Remove a control from the toolbar.
3) Close App
4) Re-Launch App - Toolbar is restored properly (the item that was removed is still removed).
5) Close App
6) Re-Launch App - Toolbar is not restored properly (the item that was removed is back, toolbar looks as it did when we first launched in step 1).

uploads/20080221_100235_TestApp.zip - uploads/20080221_100235_TestApp.zip


Posted By: Oleg
Date Posted: 21 February 2008 at 10:11am
Just switch
 
  Call Me.CommandBars.EnableCustomization(True)
and
  Call LoadPreferences
 
 
p.s. for main menu items better use xtpControlPopup than xtpControlButtonPopup


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


Posted By: cgaskill
Date Posted: 21 February 2008 at 10:15am
Great, thanks.  I was wondering if re-ordering would make a difference.  Just wasn't sure where to start.



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