Solved

3 way splitter window problem

Posted on 2001-07-30
6
278 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

911 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

25 Experts available now in Live!

Get 1:1 Help Now