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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Persisting Tab states in Tabbed MDI

Thread ID:

Created:

Updated:

Platform:

Replies:

56114 Feb 9,2007 02:13 PM UTC Feb 15,2007 07:13 PM UTC WinForms 6
loading
Tags: Tools
Surya
Asked On February 9, 2007 02:13 PM UTC

Hi :

we are using Tabbed MDI in our project. We have a scenario in which we want to persist
tab states, and reload and apply them on form load.I've seen an example on how to load them
but I donot know how to apply them.

** All child forms are created on the fly in response to user actions.We would like to persist that information,recreate the forms
on form load and apply the same state to the
tabs that was existing before closing the form.

Please advise on how to do this.

Thanks
Surya





Gopalakrishnan S [Syncfusion]
Replied On February 9, 2007 05:47 PM UTC

Hi Surya,

Thanks for using Syncfusion products.

You can use the SaveTabGroupStates() and LoadTabGroupStates()methods for save and retrieve the tab states in TabbedMDI. This states are stored in default storage location called Isoloated Storage(C:\Documents and Settings\LoginName\Local Settings\Application Data\IsolatedStorage).

Isolated storage is a data storage mechanism that provides isolation and safety by defining standardized ways of associating code with saved data.With isolated storage, your code no longer needs unique paths to specify safe locations in the file system and data is protected from other applications that only have isolated storage access.

//Call in form load event
this.tabbedMdiManager.LoadTabGroupStates();

//Call in form closing event
this.tabbedMdiManager.SaveTabGroupStates();

Another approach here would be to use a different storage format by using the SerializeMode enumerator in the AppStateSerializer as shown below :

private void Form1_Load(object sender, System.EventArgs e)
{
AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFile, "..\\..\\stateinfo");
this.tabbedMdiManager.LoadTabGroupStates(aser);
MessageBox.Show("ha");
}

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFile, "..\\..\\stateinfo");
this.tabbedMdiManager.SaveTabGroupStates(aser);
aser.PersistNow();
}

But it doesn't save the child forms that are created at runtime. This has to be done by ourself within our application. When forms are loaded at runtime, before calling LoadTabGroupStates all the forms has to be opened. So before calling this, we have to load all the form that are opened previously. So we have to save the child form that are opened previously information by ourself.

Here is sample for TabState Persistion:

test sample

Please let me know if you have any queries.

Regards,
S.Gopal.

Surya
Replied On February 9, 2007 06:42 PM UTC

Thanks for the information Gopal.
What information do I need to save on run-time created forms ?

Surya

Poly J [Syncfusion]
Replied On February 14, 2007 12:53 PM UTC

Hi Surya,

Our TabbedMdimanager architecture supports persistence of child forms created at run-time. But the run-time controls have to be recreated before LoadTabGroupStates method can be invoked since these child forms cease to exist once the application is closed. The tabbed mdi manager cannot apply the retrieved state information to anything if the child forms created at run-time are not present on the form when the LoadTabGroupStates is called. Save the names (since the Name property is used as the default PersistenceID) of the child forms before the application is closed so that they could be recreated using these names before LoadTabGroupStates method is called when the application is reloaded.
Please try this attached sample and let me know if you have any queries.

Sample

Best regards,
Poly



Surya
Replied On February 14, 2007 05:48 PM UTC

Thanks

Surya
Replied On February 14, 2007 06:22 PM UTC

If I want to find out the names of all the forms whose state is persisted and create them before
applying the states, how should I do that ?

Thanks
Surya

Poly J [Syncfusion]
Replied On February 15, 2007 07:13 PM UTC

Hi Surya,

Please find the modified sample, where the child form names are saving to an array list and using this array list you can get the names of persisted forms and create them before applying states.
Modified Sample


Please let me know if you need further assistance with this incident.

Best Regards,
Poly


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;