Re: problem creating 3 way split window

Tech-Archive recommends: Fix windows errors by optimizing your registry



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...

if (m_wndSplitter.GetSafeHwnd())
{ ... call m_wndSplitter functions
}


"nexolite" <nexolite@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:B8ACEBC9-94F4-4589-972D-9823C9C09ECF@xxxxxxxxxxxxxxxx
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


--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: doc/view question
    ... > each doc has a splitter window like windows Explorer. ... > the splitter position, I want the doc to be able to save this info, and ... Save/restore the position in the child frame class ...
    (microsoft.public.vc.mfc)
  • Re: CDocTemplate
    ... >I guess I completely misunderstood this. ... >CLeftView and create new set of splitter views. ... and populates the splitter window with the views above. ...
    (microsoft.public.vc.mfc)
  • Re: CSplitterWnd
    ... The splitter automatically takes care of sizing the views. ... the splitter bar would still lock up & not repaint the pane ... >>> splitter bar it locks up, and it does not refresh the splitter window ...
    (microsoft.public.vc.mfc)
  • Re: CRichEditView View area
    ... splitter window then the splitter is a function of the frame window and not ... Where in the CRichEditView, on creation, ...
    (microsoft.public.vc.mfc)
  • Re: Moving splitter programatically
    ... Depending how you have organised you splitter window use: ... your Mainframe for each splitter panes, and save the values into an INI file ...
    (microsoft.public.vc.mfc)