I have a question concerning state serialization/persistance in combination with child form managed/created docking panels and XP Menus.
I have an application that acts more or less like a console for Plug-Ins (think of MMC for example). The console itself provides some framework for the Plug-Ins to work in (some docked panels, some toolbars, menus etc.)
Now I have a Plug-In that does the following:
- Create a Toolbar through a ChildFrameBarManager
- Add a docking panel to the console''s DockingManager.
The docking panel is added in such a way that:
- The Plug-In instantiates the panel class
- It calls up an interface method on the conolse telling the console to add the control as a docking control, i.e:
* Add the control to the console''s Controls
* Call SetEnableDocking(...true) on the DockingManager
* Maintenance issues like SetDockLabel, SetCloseButtonVisibility etc.
When the Plug-In gets closed it does the opposite, i.e. remove the panel from the docking manger and controls etc.
Now to my problem:
Neither the toolbar''s nor the docking panel''s state are being persisted when shutting down the application.
I did not find any hint how to tell the MainFrameBarManager/ChildFrameBarManager to persist state for a child form''s toolbar.
I have tried explicitly calling LoadDockState(...)/SaveDockState(...) for the docking panel in question but I assume that once I have added the panel to the docking manager, I must not remove it again but only hide it in order for the docking manager to correctly persist the docking panel''s state. However the docs for SaveDockState(AppStateSerializer, Control) make me feel that the method will create a "special copy" of the control''s dock state which may be loaded back in later using LoadDockState(AppStateSerializer, Control).
Also: I can work around the Docking Manager using a "static" Image List in that way that I simply add Plug-In supplied images to that list and set the new image''s index on the docking panel. However, it would be a nice shortcut to have a SetDockIcon() method that accepts an image rather than an image index.
Any help would be highly appreciated. I do not want may customers to have to rearrange their desktop every time they launch my application.
Thanks in advance
DWS Holding & Services
ADAdministrator Syncfusion Team February 24, 2004 06:28 AM
1. Please refer to the sample attached which shows how you could save/load the state information for XPMenus. In a MDI parent-child scenario the child menu created using the ChildFrameBarManager merges with the parent form''s menu created using the MainFrameBarManager. So you could laod/save state information using the MainFrameBarManager''s LoadBarState/SaveBarState methods.
2. The DockingManager loads persisted state information correctly. But the controls have to be present for the retrieved dock state information to be applied to them. In your case, since the panel is created at runtime, it is not physically not present when the application is loaded. So any state information retrieved for this panel cannot be applied. Please refer to the following KB article for more information on this :
How do I save/load docking state information of an application that has docking windows created at runtime ?
This is available at the link given below :
It also has a sample application showing how to save/load docking state information for controls created at runtime.
3. We could consider your suggestion regarding the SetDockIcon method as a feature request for a future release of Essential Suite.
Please let me know if you need any other information. Thanks for choosing Syncfusion products.
KIKai IskeFebruary 24, 2004 11:53 PM
thanks for your response. If have tried/implemented both of your suggestions and they work (fine). I have already noticed that my dock state implementation worked when I stopped changing the controls'' names :)
Anyway, the two solutions do have some drawbacks as far as I''m concerned:
What I do, according to your sample, is basically saving an intermediate state of all bars under control of the MainFrameBarManager. So when I open my child form, I load a state for all bars in Form_Load and in Form_Closing I save a state for all bars. This results in the main form''s bars possibly getting moved around according to the state information saved for the child. This is not neccessarily desired. I simply want to save the state for the child form''s bars. As I have to save my child bars'' states into a seperate but the main IsolatedStorage file, I''d prefer loading/saving just the child bars'' states, i.e. have methods in MainFrameBarManager like LoadBarState(bars, aser)/SaveBarState(bars, aser)
Works fine, but....
As soon as I call up SetEnableDocking(ctrl, true) on my runtime created panels, they become visible. Next I load the dock states and the panels start moving around. Is there a way to avoid this flicker? I have already set ctrl.Visible = false, SetDockVisibility(ctrl, false) and make the panel visible right after loading the state but still, there is flicker.
As an example: 2 child panels show up next to each other and also to the right of an already docked panel (left border) resulting in three docked panels sitting next to each other. When I load state for the two runtime panels, the first will be moved atop of the main docked panel then the second panel formes a tabbed group with the first panel. I''d like to avoid this "motion"
Thanks for your help
DWS Holding & Services
ADAdministrator Syncfusion Team February 25, 2004 04:52 PM
Thanks for the update. I have created a DirectTrac incident #9518 in this regard, and will update you there from now on. In future, please address all your technical queries through DirectTrac as far as possible. Thanks for your cooperation.
IIIftekhar IvaanMarch 2, 2004 07:33 PM
I am having the same problem. Could you please let me know the update.
>Thanks for the update. I have created a DirectTrac incident #9518 in this regard, and will update you there from now on. In future, please address all your technical queries through DirectTrac as far as possible. Thanks for your cooperation.
ADAdministrator Syncfusion Team March 3, 2004 12:01 PM
I would appreciate if you could open an incident in Direct Trac specifically explaining the problem that you are facing (with the help of a sample application if possible). Thanks for your cooperation.