Persisting Tab states in Tabbed MDI
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
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
SIGN IN To post a reply.
6 Replies
GS
Gopalakrishnan S
Syncfusion Team
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.
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.
SU
Surya
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
What information do I need to save on run-time created forms ?
Surya
PJ
Poly J
Syncfusion Team
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
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
SU
Surya
February 14, 2007 05:48 PM UTC
Thanks
SU
Surya
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
applying the states, how should I do that ?
Thanks
Surya
PJ
Poly J
Syncfusion Team
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
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
SIGN IN To post a reply.
- 6 Replies
- 3 Participants
-
SU Surya
- Feb 9, 2007 02:13 PM UTC
- Feb 15, 2007 07:13 PM UTC