The initial size parameter is useless. The splitter resizes everything to
properly fill all space. You can control the sizes by calling
SetRowInfo/SetColumnInfo and RecalcLayout. Doing this in the mainframe
OnSize will help you keep control as the main window is resized.
But be warned that OnSize is also called before the splitters exist. So use
code like...
{ ... call m_wndSplitter functions
Thanks a lot.
I was able to do it as you said:
if(!m_wndSplitter.CreateStatic(this,2,1))
return FALSE;
if(!m_wndSplitter2.CreateStatic(&m_wndSplitter,1,2,WS_CHILD|WS_VISIBLE|WS_BORDER,m_wndSplitter.IdFromRowCol(0,
0)))
return FALSE;
if(!m_wndSplitter2.CreateView(0,0,pContext->m_pNewViewClass,CSize(600,100),pContext)||
!m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS(CHtmlWnd),CSize(600,100),pContext))
return FALSE;
if(!m_wndSplitter.CreateView(1,0,pContext->m_pNewViewClass,CSize(0,0),pContext))
return FALSE;
return TRUE;
BUT why the size specified in CSize() is not having any effect ?
only the width of the first split in the window at row 0 is changing while
the height still remains zero even though I have specified it to be 600 ?
"Malachy Moses" wrote:
Joe,
I believe that it is perfectly acceptable to nest CSplitterWnd's. The
documentation explicitly acknowledges nesting as a possibility, for
example, at CSplitterWnd::CreateStatic,
http://msdn.microsoft.com/en-us/library/87z44b55(VS.80).aspx
:
"The child window ID of the window ... can be AFX_IDW_PANE_FIRST
unless the splitter window is nested inside another splitter window"
To the OP:
I think your problem is your call to CreateView in the 0,0 pane of the
main splitter window. Your call creates a CFormView (I think) as the
view class for the 0,0 pane. That's wrong. You don't want any view
class for the 0,0 pane of the first splitter window, you simply want
the 0,0 pane to be occupied by the second CSplitterWnd (i.e,,
m_wndSplitter2).
To do so, CreateStatic both splitter windows before you call
CreateView for either one. In CreateStatic for the second splitter,
set the parent window and the child ID as you have already done.
Then, for the second splitter window, call CreateView for the 0,0 pane
and the 0,1 pane as you have done in your code. For the first
splitter window, call CreateView only for the 1,0 pane; do not call
CreateView for the 0,0 pane.
Compare your code with the code found here, which gives a similar
technique: http://www.codeguru.com/forum/showthread.php?t=279039