Hello.
I have having trouble getting a program to restore the the location of the splitter bar in a program with splitter views (two).
Here is the code in main.
-----
BOOL CMainFrame:nCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CString version = _T("1.0");
if (!m_wndSplitter.CreateStatic(this, 2, 1) ||
!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CView2),
CSize(0, 0), pContext) ||
!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CView1),
CSize(0, MyApp.GetProfileInt(version, _T("Size"), 300)), pContext))
return FALSE;
return TRUE;
}
The progres saves the size of the window in the register. Everything looks okay and function well except for the splitter. Here is the program design.
- program first starts with default View1 at height 300 (Note: I created view2 first for UpdateAllViews() to work right similar what Prosise presents in his book).
- progres restores size of view1 via code above.
Again, I cannot see a flaw in the code unless there is a flaw somewhere in the design. I implement the same code Prosise presents in his book to return windows size and location. Here is the code that does that.
-----
if (!(reinterpret_cast(m_pMainWnd))->RestoreWindowState())
m_pMainWnd->ShowWindow(m_nCmdShow);
-----
Is it possible that this code and the one to restore size of view1 are conflicting?
Again, I am open to all interpretations and if you have a better technique please show.
Thanks,
Kuphryn