Re: Another UpdateAllViews doesnt work problem.
- From: "philipwinder@xxxxxxxxxxxxxx" <philipwinder@xxxxxxxxxxxxxx>
- Date: 22 Sep 2006 10:04:17 -0700
Ok, update: the OnUpdate overide works when overiding itself, so it
must be something to do with the way I define the document templates:
CMultiDocTemplate* pChild1Template;
pChild1Template = new CMultiDocTemplate(IDR_MDITestingTYPE,
RUNTIME_CLASS(CMDITestingDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CChild1));
if (!pChild1Template)
return FALSE;
AddDocTemplate(pChild1Template);
CMultiDocTemplate* pChild2Template;
pChild2Template = new CMultiDocTemplate(IDR_MDITestingTYPE,
RUNTIME_CLASS(CMDITestingDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CChild2));
if (!pChild2Template)
return FALSE;
AddDocTemplate(pChild2Template);
Thanks,
Phil Winder
Ajay Kalra wrote:
The updates will be called on the view. What is CChild2? It appears to be
child frame.
--
Ajay Kalra [MVP - VC++]
ajaykalra@xxxxxxxxx
<philipwinder@xxxxxxxxxxxxxx> wrote in message
news:1158885513.089287.121970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, fairly simple, I cant get this UpdateAllViews to work, the OnUpdate
function never gets called. heres the code im using:
void CChild1::OnBnClickedButton1()
{
CMDITestingDoc* pDoc = (CMDITestingDoc*)this->GetDocument();
if (pDoc->CMyData.GetData() == 1) pDoc->CMyData.SetData(0);
else pDoc->CMyData.SetData(1);
ASSERT_VALID(pDoc);
pDoc->UpdateAllViews(NULL);
}
void CChild2::OnUpdate(CView* pSender,LPARAM lHint,CObject* pHint)
{
CMDITestingDoc* pDoc = (CMDITestingDoc*)this->GetDocument();
CWnd* pEdit = this->GetDlgItem(IDC_EDIT1);
char buffer[10];
int value = (int)pDoc->CMyData.GetData();
_itoa(value,buffer,10);
pEdit->SetWindowTextA((LPCTSTR) buffer ); // Pass value to text box
}
Many thanks,
Phil Winder
.
- Follow-Ups:
- Re: Another UpdateAllViews doesnt work problem.
- From: Ajay Kalra
- Re: Another UpdateAllViews doesnt work problem.
- References:
- Another UpdateAllViews doesnt work problem.
- From: philipwinder@xxxxxxxxxxxxxx
- Re: Another UpdateAllViews doesnt work problem.
- From: Ajay Kalra
- Another UpdateAllViews doesnt work problem.
- Prev by Date: Re: Strange error message.
- Next by Date: Regarding AFX_MANAGE_STATE
- Previous by thread: Re: Another UpdateAllViews doesnt work problem.
- Next by thread: Re: Another UpdateAllViews doesnt work problem.
- Index(es):