I have a MDIManager which is used to host various forms/pluggin-modules from seperate assemblies; (dll, exe, etc.) But when I attempt to use the Serialization and Deserialization methods of the MDIManager, it seems my child forms arn't being stored and reloaded. From the example help/doc - "Save and Restore a Tabbed MDI Layout", it uses the Save/Load from binary; but i also tried using "from xml" and through examining the xml file found that none of the obvious details of my forms are stored. In anycase, I've already resorted to saving the layout through xml manually, by iterating through the TabbedMdiMan.TabGroups[x].Tabs, etc. However the question is how do I manually load the forms back?
I am able to read my own xml file (obviously), but i need to know how to create new TabGroups, Tabs, a new tab assigned to specific group, and attach a new form to that tab.
In my application, we use Assembly.LoadFrom(~), but a simple example using local assemblies would do just fine - i'm sure i can figure out the rest.
regards,
-kel-
Kel,
Here's the section from the help file that pointed me in the right direction.
I was running into the same problem with the RestoreTab event. The key to getting all of the forms to reload correctly is the last line of this code:
e.Form = edit
I spent about half an hour hunting this down and realized I missed this line. Once I added it, all of my mdi forms were restored correctly. Good luck.
Bob
[C#]
using Infragistics.Win; using Infragistics.Win.UltraWinTabs; using Infragistics.Win.UltraWinTabbedMdi; private void ultraTabbedMdiManager1_RestoreTab(object sender, Infragistics.Win.UltraWinTabbedMdi.RestoreTabEventArgs e) { // The 'RestoreTab' event is invoked during a call to // LoadFromBinary or LoadFromXml when deserializing the // serialized MdiTab objects. The event is invoked once // for each serialized tab so that it may be associated // with an mdi child. If the Form is not initialized the // tab will be discarded. // // The 'PersistedInfo' can be used to store any serializable // value. It is opaque to the tab and can be used to store // information to help recreate the form that the tab should // be associated with. // string fileName = e.Tab.PersistedInfo as string; // By exiting without setting the 'Form' parameter, // we're discarding the tab. if (fileName == null || !System.IO.File.Exists(fileName)) return; // Create the form that we will associate with the Tab. Normally // whenever an mdi child form is created, an MdiTab is automatically // created for the form but during the RestoreTab event, this will // not happen so that new forms may be created to associate with // a deserialized tab. // EditForm edit = new EditForm(); edit.FileName = fileName; // set the MdiParent property of the new form so it // will be an mdi child form. Since the event could // be caught somewhere other than the form class, we // can access the MdiParent via the associated // UltraTabbedMdiManager's MdiParent. edit.MdiParent = e.Tab.Manager.MdiParent; // The 'WasVisible' parameter indicates whether the tab // was part of the HiddenTabs collection when the serialization // took place. If the visible state is different, then the // tab will be moved to/from the HiddenTabs collection to/from // a tab group as needed. // edit.Visible = e.WasVisible; // Set the 'Form' parameter so that the MdiTab will be // associated with the form. e.Form = edit; }
i've got the same issue: MdiTab object not being able to restore its original group location.
Have you found the problem to your issue?Do you need to create TabGroup inside RestoreTab event handler?
Thanks!
mike
i have not gotten this issue resolved, and have long given up on it. although i am pretty sure i have tried your suggestion, by manually creating TabGroups inside RestoreTab eventhandler, which doesn't seem to work either. this is because i couldn't find a way to properly bind the new TabGroups to the existing MdiTab. perhaps you may have better luck with that. please keep this post running, as i would also like to know how to solve this problem.
sincerely,
kel
I've got this working.The Mdi manager takes care of the tab groups. You just need to create child form for each tab, and assign it to the e.Tab.I have created a sample app to demo that if you are interested.
Thanks.
Helo Mike, did you ever figure out how to save and restore the layout? I've been struggling with trying to restore the layout for a few days and it's getting frustrating..... Thanks in advance. Armando
what do you mean the layout? the tab groups?
How did u do the Save and Load? SaveAsXml and LoadFromXml?
you also need to handle StoreTab and RestoreTab events?
see this thread:
http://forums.infragistics.com/forums/p/8003/32646.aspx
In my OnLoad method in the MainForm, if i do LoadTabbedMdiLayout("TabbedMdi.xml"), everything was fine, including the tab group or mdi child position.
But if i add the following line, the tab group and mdi child position would fail to work. All tabs will be added into one group. this.Visible = false;