
Mon, 09/18/2000 - 16:37
Forums:
Hello!
I've got a problem with implementing Splitter in my MFC & OpenCASCADE application - actually, everything is OK - i get 5 views and objects are displayed very good, but when i close current document and open new one using File\New menu item - only one view displays object , other display wire and do this when i point at the object with mouse only.
The same thing happens when i tried to implement splitter component into 02_1_SampleTopologyPrimitives...
So, please point me out what could it be?
Best regards, Dima Ivanets
Mon, 09/18/2000 - 21:11
Hi !
It's difficult to say what the problem is without looking at the source code, what did you change in the sample app to support splitters ?
Each Windows needs it's own view and so on, but I guess you already have this figured out.
Mikael
Tue, 09/19/2000 - 13:54
Hi, Mikael!
The problem is that i can't understand what could make such a strange effect at all. To provide splitter i redefined OnClientCreate virtual function - the common way, and add some functionality to set up preset projections in different views, so here is the source for OnClientCreate:
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) {
RECT rectClient;
int nLength = 0, nHeight = 0;
// Calculation of client area
GetClientRect(&rectClient);
nLength = rectClient.right - rectClient.left;
nHeight = rectClient.bottom - rectClient.top;
m_wndToolBar.GetWindowRect(&rectClient);
nHeight -= (rectClient.bottom - rectClient.top);
// create a splitter with 2 row, 1 columns
if (!m_wndSplitterMain.CreateStatic(this, 2, 1))
{
TRACE0("Failed to Create StaticSplitter\n");
return FALSE;
}
// add the first splitter pane - which is a nested splitter with 2 rows 2 cols
if (!m_wndSplitterChild.CreateStatic(
&m_wndSplitterMain, // our parent window is the first splitter
2, 2, // the new splitter is 2 rows, 2 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitterMain.IdFromRowCol(0, 0)
// new splitter is in the first row, first column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// add the second splitter pane
if (!m_wndSplitterMain.CreateView(1, 0,
pContext->m_pNewViewClass, CSize(nLength, nHeight / 4), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
nHeight -= nHeight / 4;
if (!m_wndSplitterChild.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(3 * nLength / 5, 3 * nHeight / 5), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitterChild.CreateView(0, 1,
pContext->m_pNewViewClass, CSize(3 * nLength / 5, 2 * nHeight / 5), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitterChild.CreateView(1, 0,
pContext->m_pNewViewClass, CSize(2 * nLength / 5, 3 * nHeight / 5), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitterChild.CreateView(1, 1,
pContext->m_pNewViewClass, CSize(2 * nLength / 5, 2 * nHeight / 5), pContext))
{
TRACE0("Failed to create fourth pane\n");
return FALSE;
}
// Setting view ID's
CHoler3dView* pView =
(CHoler3dView*) m_wndSplitterChild.GetPane(0, 0);
pView->SetViewID(CHoler3dView::ViewID_Axo);
pView =
(CHoler3dView*) m_wndSplitterChild.GetPane(0, 1);
pView->SetViewID(CHoler3dView::ViewID_Front);
pView =
(CHoler3dView*) m_wndSplitterChild.GetPane(1, 0);
pView->SetViewID(CHoler3dView::ViewID_Top);
pView =
(CHoler3dView*) m_wndSplitterChild.GetPane(1, 1);
pView->SetViewID(CHoler3dView::ViewID_Left);
pView =
(CHoler3dView*) m_wndSplitterMain.GetPane(1, 0);
pView->SetViewID(CHoler3dView::ViewID_Full);
// activate first view // SetActiveView((CView*)m_wndSplitterChild.GetPane(0,0));
return TRUE; }
If you have free time and want to help i can e-mail you whole project, if code above is not enough. Please send me notification to ivanets@hotmail.com and i send you the project...
Thanks a lot, Dima Ivanets
Tue, 10/03/2000 - 16:45
Hello!
I've already posted this message but i still can't solve the problem. When i use splitter to create several views instead of one view i get strange problem: initially everything is OK, but when i close current document and create new one everything that i display can be seen only in one view! Other views appear to be empty until i point to the place where object should be with mouse pointer - it becomes visible in wireframe mode. When i switch to wireframe mode object is visible all the time, but switching to shaded mode makes it invisible again...
So what could it be? Help me please! Code of creation splitters is:
BOOL CChildFrame3D::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) {
RECT rectClient;
int nLength = 0, nHeight = 0;
// Calculation of Frame client area
GetClientRect(&rectClient);
nLength = rectClient.right - rectClient.left;
nHeight = rectClient.bottom - rectClient.top;
// Calculation of ToolBar client area
m_wndToolBar3d.GetWindowRect(&rectClient);
// Height without toolbar height
nHeight -= (rectClient.bottom - rectClient.top);
// create a splitter with 2 row, 1 columns
if (!m_wndSplitterMain.CreateStatic(this, 2, 1))
{
TRACE0("Failed to Create StaticSplitter\n");
return FALSE;
}
// add the first splitter pane - which is a nested splitter with 2 rows 2 cols
if (!m_wndSplitterChild.CreateStatic(
&m_wndSplitterMain, // our parent window is the first splitter
2, 2, // the new splitter is 2 rows, 2 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitterMain.IdFromRowCol(0, 0)
// new splitter is in the first row, first column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// add the second splitter pane
if (!m_wndSplitterMain.CreateView(1, 0,
pContext->m_pNewViewClass, CSize(nLength, nHeight / 4), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// Height without FullLenght view pane height
nHeight -= nHeight / 4;
// add the first splitter pane in nested splitter
if (!m_wndSplitterChild.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(3 * nLength / 5, 3 * nHeight / 5), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
// add the second splitter pane in nested splitter
if (!m_wndSplitterChild.CreateView(0, 1,
pContext->m_pNewViewClass, CSize(3 * nLength / 5, 2 * nHeight / 5), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
// add the third splitter pane in nested splitter
if (!m_wndSplitterChild.CreateView(1, 0,
pContext->m_pNewViewClass, CSize(2 * nLength / 5, 3 * nHeight / 5), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
// add the fourth splitter pane in nested splitter
if (!m_wndSplitterChild.CreateView(1, 1,
pContext->m_pNewViewClass, CSize(2 * nLength / 5, 2 * nHeight / 5), pContext))
{
TRACE0("Failed to create fourth pane\n");
return FALSE;
}
// Setting ID's for views
// axonometric view
CH3dView3D* pView =
(CH3dView3D*) m_wndSplitterChild.GetPane(0, 0);
pView->SetViewID(CH3dView3D::ViewID_Axo);
// front view
pView =
(CH3dView3D*) m_wndSplitterChild.GetPane(0, 1);
pView->SetViewID(CH3dView3D::ViewID_Front);
// top view
pView =
(CH3dView3D*) m_wndSplitterChild.GetPane(1, 0);
pView->SetViewID(CH3dView3D::ViewID_Top);
// left view
pView =
(CH3dView3D*) m_wndSplitterChild.GetPane(1, 1);
pView->SetViewID(CH3dView3D::ViewID_Left);
// FullLength view
pView =
(CH3dView3D*) m_wndSplitterMain.GetPane(1, 0);
pView->SetViewID(CH3dView3D::ViewID_Full);
return TRUE; }
Thanks in advance, Dima Ivanets