Home > Software engineering >  Why didn't my new view associated with? How to link to?
Why didn't my new view associated with? How to link to?

Time:09-30

In the original space four views, and then left view is a tree structure, change the lower left and lower right view by node;;;; Lower left view can enter the Numbers and textout displayed in the lower right view, however, I found the ultimate show not to come out, check, found no link to the document, but generally the view has been created, not associated with the document automatically? Excuse me, I this how to link, the code is as follows:

Mainframe. CPP


Void CMainFrame: : SwitchToView (int nViewType)
{
The CView * pView=(the CView *) m_wndSplitter1. GetPane (1, 0);
//CRect rcRight rcFrame;
//pView - & gt; GetClientRect (& amp; RcRight);
//GetClientRect (& amp; RcFrame);
CRect rt.
GetClientRect (& amp; Rt);
The switch (nViewType)
{

Case ViewD://CListPaneView
{
if (! PView - & gt; IsKindOf (RUNTIME_CLASS (CViewD)))
{
M_wndSplitter1. DeleteView (1, 0);
M_wndSplitter1. CreateView (1, 0, RUNTIME_CLASS (CViewD),
CSize (rt) Width ()/5, rt, Height ()/10), NULL);
M_wndSplitter1. RecalcLayout ();
/* m_pLefBottomView=(CViewC *) m_wndSplitter GetPane (1, 0); */


M_wndSplitter2. DeleteView (1, 0);
M_wndSplitter2. CreateView (1, 0, RUNTIME_CLASS (CViewD),
CSize (rt) Width () * 4/5, rt, Height ()/10), NULL);
M_wndSplitter2. RecalcLayout ();
/* m_pLefBottomView=(CViewC *) m_wndSplitter GetPane (1, 1); */
}
break;
}
Case ViewC://CEditPaneView
{
if (! PView - & gt; IsKindOf (RUNTIME_CLASS (CViewC)))
{
//delete the old view
M_wndSplitter1. DeleteView (1, 0);
//create a new view
M_wndSplitter1. CreateView (1, 0, RUNTIME_CLASS (CViewC),
CSize (rt) Width ()/5, rt, Height ()/10), NULL);
//adjust distribution
M_wndSplitter1. RecalcLayout ();
/* m_pLefBottomView=(CViewC *) m_wndSplitter GetPane (1, 0); */


M_wndSplitter2. DeleteView (1, 0);
M_wndSplitter2. CreateView (1, 0, RUNTIME_CLASS (CViewB),
CSize (rt) Width () * 4/5, rt, Height ()/10), NULL);
M_wndSplitter2. RecalcLayout ();
/* m_pLefBottomView=(CViewC *) m_wndSplitter GetPane (1, 1); */
}
break;
}

Default:
break;
}

}


The lower right corner view:
Void CViewB: : ontouch * pDC (CDC)
{
CKnifeTestDoc * pDoc=(CKnifeTestDoc *) this - & gt; GetDocument ();
PDC - & gt; TextOut (100, 10, pDoc - & gt; M_docstr1);
PDC - & gt; TextOut (250, 10, pDoc - & gt; M_docstr2);
.
}

In the lower left corner of the view parameter can be saved to the doc, but there is no link to the document view and the bottom right hand corner,,, is what is going wrong? Sincerely thank you ~

CodePudding user response:

Nobody answer ah ~ ~

CodePudding user response:

https://wenku.baidu.com/view/1786a7d4cc22bcd126ff0cc2.html
  • Related