Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - SaveStateToString/LoadStateFromString
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SaveStateToString/LoadStateFromString

 Post Reply Post Reply
Author
Message
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post Topic: SaveStateToString/LoadStateFromString
    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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2008 at 6:19pm
Same result.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2008 at 1:29am
Hi,
 
We need some sample to debug it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
cgaskill View Drop Down
Newbie
Newbie


Joined: 13 April 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote cgaskill Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.158 seconds.