Solved

3 way splitter window problem

Posted on 2001-07-30
6
288 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
ID: 6333292
You must not override GetPane... Just call it!

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

-- Dan
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6333296
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 31

Accepted Solution

by:
Zoppo earned 50 total points
ID: 6333312
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

Expert Comment

by:DanRollins
ID: 6333314
<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
ID: 6333342
if i had more points - you are the winner.
thanks
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 6333352
you're welcome...

have a nice day,

regards,

ZOPPO
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

713 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