Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pb with split windows display

Status
Not open for further replies.

ltsi

Programmer
Jul 10, 2003
7
FR
Hi.

I have a document in which there is a CView and CFormView within a split window. I am using the following function to make a switch between the 2 CViews and the 2 CFormViews simultaneously:

void CMainFrame::ReplaceView(int row, int col, CRuntimeClass *pViewClass, SIZE size)
{
BOOL bSetActive=TRUE;


//if ((m_wndSplitter.GetPane(row,col)->IsKindOf(pViewClass))==TRUE)
//return FALSE;


// Get pointer to CDocument object so that it can be used in the creation
// process of the new view
CDocument * pDoc= ((CView *)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(row,col))->GetDocument();
CView * pActiveView = (CView*)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(row,col)->GetActiveWindow();
if (pActiveView==NULL || pActiveView==m_wndSplitter.GetPane(row,col))
bSetActive=TRUE;
else
bSetActive=FALSE;

// set flag so that document will not be deleted when view is destroyed
pDoc->m_bAutoDelete=FALSE;
// Delete existing view
((CView *)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(row,col))->DestroyWindow();
// set flag back to default
pDoc->m_bAutoDelete=TRUE;

// Create new view

CCreateContext context;
context.m_pNewViewClass=pViewClass;
context.m_pCurrentDoc=pDoc;
context.m_pNewDocTemplate=NULL;
context.m_pLastView=NULL;
context.m_pCurrentFrame=NULL;

CView * pNewView= (CView *)((CMainFrame*)AfxGetMainWnd())-> m_wndSplitter.CreateView(row,col,pViewClass,size, &context);

//CView * pNewView= (CView *)((CMainFrame*)AfxGetMainWnd())->m_wndSplitter.GetPane(row,col);



RecalcLayout();
RedrawWindow();



}

It works perfectly.
But when making the switch between the CViews and the CFormViews, the two split windows are not active right now. I have to make a increase of the window in order to get access to the functions of the CFormView.
How can I do?

If somebody can help me, I would be very happy.
Thanks.
LTSI.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top