I am trying to save the MDI state when closing the application and load it when opening. Like FireFox, it opens all the web pages last time when you close the application. I've noticed that UltraTabbedMdiManager have methods like SaveAsXml and LoadFromXml.What is contained in the saved XML file?
What do I need to do if I want to open the last visited pages like FireFox? Thanks.Mike
The XML file will contain all properties and values which are publicly exposed in the tabbed mdi manager. It is intended to save customizations the user might have made, through both the default UI, as well as any additional UI you have added to your application to give the user control over certain aspects of the tabbed mdi manager. One of the reasons to save and load this file would be to maintain the tab groups into which the user has organized the mdi child forms. However, loading the XML file will not open the forms which were previously opened. You must keep track of which forms were open when the XML file was saved and re-open them before loading the XML file.
>You must keep track of which forms were open when the XML file was saved and re-open them before loading the XML file.
So i guess i should save the open forms into a separate file, instead of messing this XML file.
In fact, all I want to save for each form is the file name to initialize it. Is it possible to tag objects (e.g., the list of file names in this case) to the UltraTabbedMdiManager? Is it worth doing that?
>to maintain the tab groups into which the user has organized the mdi child formsThe only think i can think of is to switch between normal MDI and tabbed MDI. Anything else user acn do to organize child forms?Thanks!
I tried to save child MDI forms in a separate file and successfully load them within MainForm's OnLoad method.But the LoadTabbedMdiLayout does not seems to work, even if i put it after loading all the child MDI forms. Even worse, it messes up the layout.I also tried to put LoadTabbedMdiLayout in OnLayout method in the MainForm, and it behaves the same.
Do you have any idea what is going wrong? and how can i make this work?
Thanks.
I must apologize: I was thinking about how the dock manager loads the layout and I assumed the tabbed mdi manager worked the same way, so I am sorry for giving bad advice. I have checked with someone more familiar with this component, and there are properties and events built in specifically for what you are trying to do. Handle the StoreTab event on the tabbed mdi manager. When a tab is going to be serialized to the XML file, this event will be fired for each tab. In your case, when you handle this event, set the PersistedInfo of the tab for which the event is being fired to the file name associated with the tab. For deserialization, handle the RestoreTab event. This event will be fired for each tab which was serialized. In the handler, you can get the PersistedInfo for the tab and create a Form (or use an existing Form) to use for the tab. Set the Form on the Form property of the event arguments.
I tried to add StoreTab and RestoreTab event handler, and they were called when SaveAsXml and LoadFromXml.
All the MDI child forms were loaded successfully, but the MDI layout does not.
For example, if i create a new horizontal Tab group, the group dissapears when loading next time. If i am not use tab, the sizes and positions of child forms were not loaded propertly next time.The only difference it can tell is whether the layout is tabbed or not, and this was loaded properly.
Any idea what's going wrong?
Thanks!
It could be a bug. I would recommend submitting a sample which reproduces the issue to the support group: http://ko.infragistics.com/gethelp.
I managed to find out the cause of the problem, but i do not understand why.
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;
Can you think of any reason why? The reason I added this line is because it takes some time to LoadTabbedMdiLayout, and I do not want to show some blank screen while it is loading.
I can't think of any reason why it wouldn't work but I wouldn't be surprised if there was some timing issue occuring because Visible is changing in the OnLoad. If you must load the layout in the OnLoad because that is the earliest point at which you can access the mdi children, report the issue to the support group. They may find a workaround or a bug with the tabbed mdi manager which can be fixed. Otherwise, I would recommend trying to load the layout in the constructor so you don't need to worry about setting Visible to False.