Dynamic CSplitterWnd
-
I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.
cheers, Neil
-
I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.
cheers, Neil
And the assertion is....?
-
And the assertion is....?
Sorry, assertion is in WINSPLIT.CPP: if (GetDlgItem(IdFromRowCol(row, col)) != NULL) { TRACE2("Error: CreateView - pane already exists for row %d, col %d.\n", row, col); ASSERT(FALSE); return FALSE; } cheers, Neil
-
Sorry, assertion is in WINSPLIT.CPP: if (GetDlgItem(IdFromRowCol(row, col)) != NULL) { TRACE2("Error: CreateView - pane already exists for row %d, col %d.\n", row, col); ASSERT(FALSE); return FALSE; } cheers, Neil
A dynamic splitter creates the first default pane (cell 0,0) so you can't create another view there. You may need to use DeleteView() on that pane first before adding your own pane. I'd have to test this as I've only used static splitters. Mark
-
I have created a dynamic splitter with: CSplitterWnd clientSplitter; .. clientSplitter.Create(this, 2, 2, CSize(200, 200), pContext, WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST); How do I add a view to it? This code .. clientSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext); .. causes an ASSERT.
cheers, Neil
I got around to testing it. This should work...
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CCreateContext CreateContext;
CreateContext.m_pCurrentFrame = this;
CreateContext.m_pNewViewClass = RUNTIME_CLASS(CLeftView);clientSplitter.Create(this, 2, 2, CSize(200, 200), &CreateContext,
WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST);return TRUE;
} -
I got around to testing it. This should work...
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CCreateContext CreateContext;
CreateContext.m_pCurrentFrame = this;
CreateContext.m_pNewViewClass = RUNTIME_CLASS(CLeftView);clientSplitter.Create(this, 2, 2, CSize(200, 200), &CreateContext,
WS_CHILD | WS_VISIBLE | SPLS_DYNAMIC_SPLIT, AFX_IDW_PANE_FIRST);return TRUE;
}Thanks. That works fine.
cheers, Neil