Hi, I am doing an MFC MDI application with VS 8.0. I am using the default document view plus a formview ans show both of them in the view using a splitter.
In the formview there is an event onBtnclicked that displays some valued entered by the user in the document. Here is the code in my formview:
the application is updating the view (and drawing the text) only after the application itself has been hidden (under another application, or minimized) and showing again.
Also, i tried doing it in a third class
and the problem is the same, it does not update the view in real time.
Thanks for helping!
In the formview there is an event onBtnclicked that displays some valued entered by the user in the document. Here is the code in my formview:
Code:
// MyForm.cpp
void CMyForm::OnBnClickedButtonok()
{[INDENT]CTP1Doc *pDoc = (CTP1Doc *)GetDocument();
pDoc->hello += "BONJOUR";
pDoc->UpdateAllViews(this);[/INDENT]
}
// TP1View.cpp
void CTP1View::OnDraw(CDC* pDC)
{[INDENT]CTP1Doc* pDoc = GetDocument();
CTP1Doc* pDoc2 = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->TextOut(10,10,pDoc->hello);
pDC->TextOut(10,25,pDoc2->hello2);[/INDENT]
}
Also, i tried doing it in a third class
Code:
//MatriceCalculs.cpp
float CMatriceCalculs::VerifSolution(float *matriceA[2][2], float *matriceB[2][1])
{[INDENT]CMDIFrameWnd *pFrame = (CMDIFrameWnd*) AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
CTP1View *pView = (CTP1View *)pChild->GetActiveView();
CTP1Doc *pDoc = pView->GetDocument();
pDoc->hello += "// y = kekchose ";
return 1.0;[/INDENT]
}
Thanks for helping!
Comment