-
December 6th, 2018, 05:57 AM
#1
Loading and restoring MDI groups
I have an example of MDI app, where I tried to save and then restore a MDI tab group. And the example id from microsoft: RibbonMDIDemo ... but simply not working:
Code:
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
OnFileNew();
OnFileNew();
OnFileNew();
OnFileNew();
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
{
if (! pMainFrame->LoadMDIState(GetRegSectionPath()))
{
if (! ProcessShellCommand(cmdInfo))
return FALSE;
}
}
else
{
// Dispatch commands specified on the command line
if (! ProcessShellCommand(cmdInfo))
return FALSE;
}
and
Code:
BOOL CRibbonMDIDemoApp::SaveAllModified()
{
if (!CWinAppEx::SaveAllModified ())
{
return FALSE;
}
CMDIFrameWndEx* pMainFrame = DYNAMIC_DOWNCAST (CMDIFrameWndEx, m_pMainWnd);
if (pMainFrame != NULL)
{
pMainFrame->SaveMDIState(GetRegSectionPath ());
}
return TRUE;
}
now, if I move some view in another tab group, and when I close the app, why this secnod tab group is not saved ? I attach the demo project, which is from microsoft in fact: RibbonMDI.zip
-
December 6th, 2018, 06:10 AM
#2
Re: Loading and restoring MDI groups
Debug your app. Step into
LoadMDIState
SaveMDIState
GetRegSectionPath
and see what the methods are saving into the registry to find what data is missing. Also, do you need to add a second SaveMDIState/LoadMDIState pair on the window that isn't getting saved?
-
December 6th, 2018, 08:16 AM
#3
Re: Loading and restoring MDI groups
Yes, I noticed that views must be saved in order to be saved, but I don't know why this is not happen every run test ... and how can I save/restore views that, as you said, haven't been saved ? Let say I am display something that could not be saved ...
Last edited by mesajflaviu; December 6th, 2018 at 08:21 AM.
-
December 6th, 2018, 08:23 AM
#4
Re: Loading and restoring MDI groups
If I would handle the saving and restoring of opened documents on my own, how can I open a new document/view in a specific tab group ?
Later edit: I guess is not a good idea, I should not re-invent the wheel ... I only need to find how to use it
Last edited by mesajflaviu; December 6th, 2018 at 08:48 AM.
-
December 6th, 2018, 09:48 PM
#5
Re: Loading and restoring MDI groups
Originally Posted by mesajflaviu
Yes, I noticed that views must be saved in order to be saved, but I don't know why this is not happen every run test ... and how can I save/restore views that, as you said, haven't been saved ? Let say I am display something that could not be saved ...
Put breakpoints on the Load and Save MDIState methods. Then debug by manipulating the view that works. When the break points get hit, use the call stack window to back up the stack to notice the chain of method calls that initially invoke the load or save. Next compare with the views that don't work to find out what code is missing.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|