Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2003, 10:45 AM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Splitter window problems

I am trying to make a SDI with splitters that look like this:
_____________
| | |
| |________|
| | |
| |________|
| | |
|___|________|

When I create them, I get an exception. Here is my code for creating them. Can somebody please tell me what I am doing wrong?

m_wndSplitter.CreateStatic(this,1, 2);
m_wndSplitter2.CreateStatic(&m_wndSplitter,2, 1);
    m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CDataCo llectorView),CSize(30,50),pContext);
    m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CDataC ollectorView),CSize(30,50),pContext);
    m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CDataCo llectorView),CSize(10,10),pContext);

Thanks in advance

Thanks,
Bob
 
Old September 29th, 2003, 11:04 AM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try something like this, you might have to change the classes to what you want.

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// create splitter window
if (!m_wndSplitter.CreateStatic(this, 1, 2))
     return FALSE;

if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CDataCollectorView), CSize(1, 1), pContext))
{
    m_wndSplitter.DestroyWindow();
    return FALSE;
}

// create another splitter window inside the other
if (!m_wndSplitter2.CreateStatic(&m_wndSplitter, 3, 1, WS_CHILD | WS_VISIBLE,
    m_wndSplitter.IdFromRowCol(0,1)))
{
    return FALSE;
}

if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CDataCollectorView), CSize(1, 1), pContext) ||
     !m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CDataCollectorView), CSize(1, 1), pContext) ||
     !m_wndSplitter2.CreateView(2, 0, RUNTIME_CLASS(CDataCollectorView), CSize(1, 1), pContext))
    return FALSE;

    return TRUE;
}

 
Old September 29th, 2003, 11:24 AM
Registered User
 
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried your code and I still get the exception. This code works:

if (!m_wndSplitter.CreateStatic(this, 1, 2))
        return FALSE;

if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDataCollectorView), CSize(100, 100), pContext) ||
!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CDataCollectorView), CSize(100, 100), pContext))
    {
        m_wndSplitter.DestroyWindow();
        return FALSE;
    }

but if I try to add splitters, it blows up.

Thanks,
Bob
 
Old September 30th, 2003, 01:01 AM
Authorized User
 
Join Date: Jun 2003
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What exception do you get?
 
Old October 4th, 2003, 05:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Gert,
Try this code

    if (!m_wndSplitter.CreateStatic(this,1,2))
        return FALSE;

    if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CSplitSDIView), CSize(100, 100), pContext))// ||
    {
        m_wndSplitter.DestroyWindow();
        return FALSE;
    }

    if (!m_wndSplitter1.CreateStatic(&m_wndSplitter, 4, 1, WS_CHILD | WS_VISIBLE | WS_BORDER ,
        m_wndSplitter.IdFromRowCol(0,1)))
        return FALSE;

    if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CSplitSDIView), CSize(100, 100), pContext) ||
        !m_wndSplitter1.CreateView(1, 0, RUNTIME_CLASS(CSplitSDIView), CSize(100, 100), pContext) ||
        !m_wndSplitter1.CreateView(2, 0, RUNTIME_CLASS(CSplitSDIView), CSize(100, 100), pContext) ||
        !m_wndSplitter1.CreateView(3, 0, RUNTIME_CLASS(CSplitSDIView), CSize(100, 100), pContext))
    {
        m_wndSplitter1.DestroyWindow();
        return FALSE;
    }
    return TRUE;

Ankur Verma
.Net and C++ Specialist
Wiley Tech Support





Similar Threads
Thread Thread Starter Forum Replies Last Post
window.opener problems crmpicco Javascript How-To 2 September 30th, 2005 03:46 AM
Problems with Popup Window in IE kevorkian Javascript 2 June 22nd, 2005 10:08 AM
loadMovie causing window status problems Snib Flash (all versions) 0 July 21st, 2004 06:32 PM
Switch between views in a SDI with Splitter? nadin_sam Visual C++ 0 April 26th, 2004 08:41 AM
Window Class problems drb2k2 C++ Programming 1 October 1st, 2003 06:10 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.