Chris Korczak
June 4th, 1999, 09:17 AM
I am having a problem creating the splitter windows that I want. I want to split two times.
The following is a rough scetch to show exactly what I mean.
*I have forgone the picture, as it does not come out well with the posting...the font changes and such, and for some reason it is not liking my spaces at all. I want to have 2 panes, and then split the left-hand pane in half...horizontally..
This is roughly what I am looking for, with the lines in the picture being splitter, discounting the borders, of course. I seem to have done everything to the besdt of my knowledge, but it never draws the split through the first left pane. I want to split that pane. Any suggestions?
Here is the code I have thus far:
void CMainFrame::CreateSplitter()
{
CCreateContext context;
memset( &context, 0, sizeof(context) );
CRect rect;
GetClientRect(&rect);
CScrollView *curView = (CScrollView *)m_splitterWnd->GetPane(0,0);
context.m_pCurrentDoc = curView->GetDocument();
CSplitterWnd *newSplitter = new CSplitterWnd;
if(m_isStaticSplitter)
{
// Create dynamic splitter
context.m_pNewViewClass = RUNTIME_CLASS(CDB_SplitterView);
newSplitter->Create(this,2,2,CSize(1,1),&context);
// Remove right-hand pane from static splitter
m_splitterWnd->DeleteView(0,1);
}
else
{
// Create static splitter
newSplitter->CreateStatic(this,1,2);
// Create views as children of splitter
newSplitter->CreateView(0,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right/5,rect.bottom),&context);
newSplitter->CreateView(0,1,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right/5,rect.bottom),&context);
//newSplitter->CreateView(1,0,RUNTIME_CLASS(CDB_SplitterView),
// CSize(0,0),&context);
// Make 'em scrollable/scalable
((CDB_SplitterView *)newSplitter->GetPane(0,0))->SetVerticalScrollOnly();
((CDB_SplitterView *)newSplitter->GetPane(0,1))->SetVerticalScrollOnly();
//now that we have created the 2 main windows,
//lets split the lefthand one
CSplitterWnd *childSplitter = new CSplitterWnd;
CSplitterWnd *parentSplitter = ((CSplitterWnd *)newSplitter->GetPane(0,0));
childSplitter->CreateStatic(parentSplitter,2,1);
childSplitter->CreateView(0,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right,rect.bottom/2),&context);
childSplitter->CreateView(1,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right,rect.bottom),&context);
((CDB_SplitterView *)childSplitter->GetPane(0,0))->SetVerticalScrollOnly();
((CDB_SplitterView *)childSplitter->GetPane(1,0))->SetVerticalScrollOnly();
// Remove all but first pane from dynamic splitter
if( m_splitterWnd->GetRowCount()>1 )
m_splitterWnd->DeleteRow(1);
if( m_splitterWnd->GetColumnCount()>1 )
m_splitterWnd->DeleteColumn(1);
}
// Delete old splitter, remember new
context.m_pCurrentDoc->RemoveView(curView);
m_splitterWnd->DestroyWindow();
delete m_splitterWnd;
m_splitterWnd = newSplitter;
m_splitterWnd->SetActivePane(0,0);
OnUpdateFrameTitle(TRUE);
RecalcLayout();
m_isStaticSplitter = !m_isStaticSplitter;
}
The following is a rough scetch to show exactly what I mean.
*I have forgone the picture, as it does not come out well with the posting...the font changes and such, and for some reason it is not liking my spaces at all. I want to have 2 panes, and then split the left-hand pane in half...horizontally..
This is roughly what I am looking for, with the lines in the picture being splitter, discounting the borders, of course. I seem to have done everything to the besdt of my knowledge, but it never draws the split through the first left pane. I want to split that pane. Any suggestions?
Here is the code I have thus far:
void CMainFrame::CreateSplitter()
{
CCreateContext context;
memset( &context, 0, sizeof(context) );
CRect rect;
GetClientRect(&rect);
CScrollView *curView = (CScrollView *)m_splitterWnd->GetPane(0,0);
context.m_pCurrentDoc = curView->GetDocument();
CSplitterWnd *newSplitter = new CSplitterWnd;
if(m_isStaticSplitter)
{
// Create dynamic splitter
context.m_pNewViewClass = RUNTIME_CLASS(CDB_SplitterView);
newSplitter->Create(this,2,2,CSize(1,1),&context);
// Remove right-hand pane from static splitter
m_splitterWnd->DeleteView(0,1);
}
else
{
// Create static splitter
newSplitter->CreateStatic(this,1,2);
// Create views as children of splitter
newSplitter->CreateView(0,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right/5,rect.bottom),&context);
newSplitter->CreateView(0,1,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right/5,rect.bottom),&context);
//newSplitter->CreateView(1,0,RUNTIME_CLASS(CDB_SplitterView),
// CSize(0,0),&context);
// Make 'em scrollable/scalable
((CDB_SplitterView *)newSplitter->GetPane(0,0))->SetVerticalScrollOnly();
((CDB_SplitterView *)newSplitter->GetPane(0,1))->SetVerticalScrollOnly();
//now that we have created the 2 main windows,
//lets split the lefthand one
CSplitterWnd *childSplitter = new CSplitterWnd;
CSplitterWnd *parentSplitter = ((CSplitterWnd *)newSplitter->GetPane(0,0));
childSplitter->CreateStatic(parentSplitter,2,1);
childSplitter->CreateView(0,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right,rect.bottom/2),&context);
childSplitter->CreateView(1,0,RUNTIME_CLASS(CDB_SplitterView),
CSize(rect.right,rect.bottom),&context);
((CDB_SplitterView *)childSplitter->GetPane(0,0))->SetVerticalScrollOnly();
((CDB_SplitterView *)childSplitter->GetPane(1,0))->SetVerticalScrollOnly();
// Remove all but first pane from dynamic splitter
if( m_splitterWnd->GetRowCount()>1 )
m_splitterWnd->DeleteRow(1);
if( m_splitterWnd->GetColumnCount()>1 )
m_splitterWnd->DeleteColumn(1);
}
// Delete old splitter, remember new
context.m_pCurrentDoc->RemoveView(curView);
m_splitterWnd->DestroyWindow();
delete m_splitterWnd;
m_splitterWnd = newSplitter;
m_splitterWnd->SetActivePane(0,0);
OnUpdateFrameTitle(TRUE);
RecalcLayout();
m_isStaticSplitter = !m_isStaticSplitter;
}