Update only a part of a View with OnUpdateAllViews 2nd !
-
Hi, i programmed a little app (SDI + RichCtrl). In this app. text is printed to the view when the program is started. When the user pushes the Button the ChangeText() fnct. in the doc will be called which only updates the rect with a new text. For a better understanding here is a pic: http://filehosting.at/images/download.php?file=585bdf52f01deea892f9e8b46fb652aa I tried with the UpdateAllViews() in the doc and OnUpdate() in the view.cpp. But it will not work ! To avoid posting too much code i coded a small sample which the same problem, perhaps you could have a look in the code ??? :-\ I really couldn't get it to work :(( :confused: http://www.filehosting.at/files/download.php?file=3e48616e695e66ed38f382a4c91fb3bc Many thanx for your help and best regards ;) Coc
-
Hi, i programmed a little app (SDI + RichCtrl). In this app. text is printed to the view when the program is started. When the user pushes the Button the ChangeText() fnct. in the doc will be called which only updates the rect with a new text. For a better understanding here is a pic: http://filehosting.at/images/download.php?file=585bdf52f01deea892f9e8b46fb652aa I tried with the UpdateAllViews() in the doc and OnUpdate() in the view.cpp. But it will not work ! To avoid posting too much code i coded a small sample which the same problem, perhaps you could have a look in the code ??? :-\ I really couldn't get it to work :(( :confused: http://www.filehosting.at/files/download.php?file=3e48616e695e66ed38f382a4c91fb3bc Many thanx for your help and best regards ;) Coc
did u try Invalidate() ?
-
did u try Invalidate() ?
Hi, i used InvalidateRect(); Please look in the small code ;) Many thanx Coc
-
Hi, i used InvalidateRect(); Please look in the small code ;) Many thanx Coc
This is the code from the doc:
CString CON_UPDATE_DEMODoc::ChangeText()
{
CRect MyRect(0,0, 100, 100);
CObject* pHint = (CObject*)&MyRect;m\_cstrAusgabe = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; UpdateAllViews(NULL, 1, pHint); return m\_cstrAusgabe;
}
and this from the view:
void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument()); //m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe); if (pHint != 0) { InvalidateRect((CRect\*)pHint, TRUE); m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe); return; } m\_Rich.SetModify(TRUE); CView::OnUpdate(pSender, lHint, pHint);
}
-
This is the code from the doc:
CString CON_UPDATE_DEMODoc::ChangeText()
{
CRect MyRect(0,0, 100, 100);
CObject* pHint = (CObject*)&MyRect;m\_cstrAusgabe = " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; m\_cstrAusgabe += " BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER \\r\\n\\ BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER BLUBBER"; UpdateAllViews(NULL, 1, pHint); return m\_cstrAusgabe;
}
and this from the view:
void CON_UPDATE_DEMOView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
CMainFrame *pMF = DYNAMIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
CON_UPDATE_DEMODoc *pDoc = DYNAMIC_DOWNCAST(CON_UPDATE_DEMODoc, pMF->GetActiveDocument()); //m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe); if (pHint != 0) { InvalidateRect((CRect\*)pHint, TRUE); m\_Rich.SetWindowText(pDoc->m\_cstrAusgabe); return; } m\_Rich.SetModify(TRUE); CView::OnUpdate(pSender, lHint, pHint);
}
CrocodileBuck wrote:
m_Rich.SetWindowText(pDoc->m_cstrAusgabe);
Since
m_Rich
is aCRichEditCtrl
, why not just derive your view fromCRichEditView
? Or, you can derive it fromCFormView
and add aCRichEditCtrl
to it. Otherwise, the way you rare going about this is all wrong."Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne