 |
| 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
|
|
|
|

September 29th, 2003, 10:45 AM
|
|
Registered User
|
|
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 29th, 2003, 11:04 AM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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;
}
|
|

September 29th, 2003, 11:24 AM
|
|
Registered User
|
|
Join Date: Sep 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|
|

September 30th, 2003, 01:01 AM
|
|
Authorized User
|
|
Join Date: Jun 2003
Posts: 95
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What exception do you get?
|
|

October 4th, 2003, 05:05 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|
 |