Solved

3 way splitter window problem

Posted on 2001-07-30
6
285 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Smart Camera scanning and reading information 3 113
centeredAverage challenge 8 179
mapBully challenge 6 152
Problem to App source 6 72
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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