Solved

3 way splitter window problem

Posted on 2001-07-30
6
276 Views
Last Modified: 2013-11-20
Hi,
i'm trying to create a 3 way static splitter window and the app is crashing.
the code:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
     if(!m_wndSplitter1.CreateStatic(this,2,1)||
          !(m_wndSplitter1.CreateView(0,
          0,
          RUNTIME_CLASS (CRwrSimView),
          CSize(0,128),
          pContext)) ||
          !(m_wndSplitter2.CreateStatic     (&m_wndSplitter1,1,2,WS_CHILD|WS_VISIBLE|WS_BORDER,
  m_wndSplitter1.IdFromRowCol(1,0))||
!(m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS (CLstVwInfraView), CSize(0,128),
               pContext)||
             !(m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS (CRwrSimView), CSize(0,0),
               pContext)))))
  return FALSE;      
     
return TRUE;
}
the app is crashing in

CWnd* CSplitterWnd::GetPane(int row, int col) const
{
     ASSERT_VALID(this);

     CWnd* pView = GetDlgItem(IdFromRowCol(row, col));
     ASSERT(pView != NULL);  // panes can be a CWnd, but are usually CViews
     return pView;
}
the CSplitterWnd is the parent one(m_wndSplitter1)
thanks.

0
Comment
Question by:alons
6 Comments
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
You must not override GetPane... Just call it!

CMyView* pView= (CMyView*)m_pSplitter->GetPane( row, clm );

-- Dan
0
 
LVL 9

Expert Comment

by:ShaunWilde
Comment Utility
so by looking at your code you have

<pre>
          CRwrSimView
_____________________________
                |
CLstVwInfraView | CRwrSimView
                |            
</pre>

the only pane you can access from m_wndSplitter1 is the top pane you have to use the other splitter to access the bottom panes


0
 
LVL 30

Accepted Solution

by:
Zoppo earned 50 total points
Comment Utility
Hi alons,

if the code you pasted here is an exacty copy of the code you're using you have a parentesis-problem in this
condition:

   !(m_wndSplitter2.CreateStatic     (&m_wndSplitter1,1,2,WS_CHILD|WS_VISIBLE|WS_BORDER,
                      m_wndSplitter1.IdFromRowCol(1,0))||
   !(m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS (CLstVwInfraView), CSize(0,128),
   pContext)||
                                 !(m_wndSplitter2.CreateView(0,1,RUNTIME_CLASS (CRwrSimView), CSize(0,0),
                                   pContext)))))

if the CreateStatic(...) returns TRUE the whole statement including the both CreateView()-calls evaluates to TRUE without the CreateView()-calls executed.

I would suggest that you write your code a bit better readable ... this may preserves bugs.

hope that helps,

ZOPPO
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
<i>but alons should not try to instantiate CSplitterWnd code... If anything, he could derive a class from it...</i>

-- Dan
0
 

Author Comment

by:alons
Comment Utility
if i had more points - you are the winner.
thanks
0
 
LVL 30

Expert Comment

by:Zoppo
Comment Utility
you're welcome...

have a nice day,

regards,

ZOPPO
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now