We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Serialization Problem in TabbedMDIManager

Hello, I am using TabbedMDIManager in my application. I am using the features "New Horizontal Tab Group" and "New Vertical Tab Group". After moving some of the controls to New Horizontal Tab Group or Vertical Tab group, i am saving the state of the TabbedMDIManager to file using AppStateSerializer and FileStream in binary format. When i reload the file, i am calling TabbedMDIManager''s LoadTabGroupStates. The TabbedMDIManager does not construct the previous state correctly, all the controls are placed in a single default Tab Group. Let me know how to resolve the problem. Regards, Suresh Mani

5 Replies

Administrator February 24, 2004 12:03 PM UTC

Hi Suresh, You could load and save tabbed MDI state information using the TabbedMDIManager''s LoadTabGroupStates/SaveTabGroupStates method. The Load module should look as shown below : this.memstream.Position = 0; AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, memstream); this.tabbedMDIManager.LoadTabGroupStates(aser); The Save module should look as shown below : AppStateSerializer aser = new AppStateSerializer(SerializeMode.BinaryFmtStream, memstream); this.tabbedMDIManager.SaveTabGroupStates(aser); aser.PersistNow(); Please refer to the sample application attached here which shows how this can be done. Let me know if you need any additional information. Thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Administrator August 8, 2005 02:39 PM UTC

I am encountering the same problem as Suresh. I downloaded your sample and rebuilt it using V3.2.1.1. Unless I am missing something, the sample code does not work at all. If I move one of the tabs to a new horizontal row, click Save, then close all tabs and click Load, nothing happens. Is this a bug, or am I misunderstanding how this is supposed to work? Peter

Administrator August 8, 2005 09:18 PM UTC

Hi Pete, I believe your problem here is not the same one as above. The SaveTabGroupStates/LoadTabGroupStates methods internally use the AppStateSerializer for serializing/deserializing application state information. Note that the AppStateSerializer can only save/load state information, but cannot create or destroy controls. So after you save the tabbedMDI layout, close all the child forms, and try to load the TabbedMDI layout information, the state information is correctly deserialized but since there are no MDI child forms, the application state cannot be restored. Like I mentioned earlier the AppStateSerializer can only save/load state information but cannot create MDI child forms. So if you wish to restore state information after closing the MDI child forms, then you would have to recreate those forms again and then invoke the LoadTabGroupStates method. Please try this and let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.

Administrator August 9, 2005 12:19 PM UTC

Guru, Thank you for the response. I understand part of your response, but I''m not sure how to put it into use. First, let me summarize the goal. Given a main Form with a set of N (possibly different) MDI child Forms layed out in a particular order (in one or more horizontal/vertical tab groups), I''d like to serialize the state of this so that when I reload I can re-create those Forms and their placement in the tab groups. I see that when I serialize the tab group states using the AppStateSerializer, there appears to be valid information in the output (I used the XML serializer for somewhat better readability). But my question to you is how to properly restore the state? I understand that the call to LoadTabGroupStates() cannot recreate the Forms, but how can I find out which Forms were persisted in the first place? I tried a simple test where I hard coded the creation of the MDI child Forms that were there when I called SaveTabGroupStates() and it did work. But is there any way to dig out the types of the Forms, or is this something I have to persist separately? Thank you, Peter

Administrator August 11, 2005 03:23 PM UTC

Hi Pete, Thanks for the update. I am afraid, the TabbedMDIManager does not have any built-in support to detect the child forms that were present at the point when the SaveTabGroupStates method was invoked. You would have to explicitly keep track of all the child forms that were present on the saved layout and then recreate them just before loading the saved state. If you load the state without recreating the forms, the state information will still be de-persisted correctly and applied to those forms that are currently present and were also a part of the saved layout. In other words, the child form tracking and recreation has to be done externally and the TabbedMDIManager does not assist you in this regard. Let me know if you need additional information. Regards, Guru Patwal Syncfusion, Inc.
Live Chat Icon For mobile
Up arrow icon