Re: Multiple Views: how to open both views at startup or on new document
Try "this" for this document.
Joseph M. Newcomer wrote:
'this'. You're IN the document!
Thank you guys! Now you see how much of a begginer I am.
But now I get a compiler error that looks very strange to me:
C:\(...)\SequDoc.cpp(79) : error C2227: left of '->CreateNewFrame' must
point to class/struct/union
C:\(...)\SequDoc.cpp(83) : error C2227: left of '->InitialUpdateFrame'
must point to class/struct/union
This is the code, with the troublesome lines marked:
CMDIChildWnd* pNewFrame = (CMDIChildWnd*)
(CSequApp::m_pEditorTemplate->CreateNewFrame(this, NULL)); // <---
if (pNewFrame == NULL)
return FALSE; // not created
CSequApp::m_pEditorTemplate->InitialUpdateFrame(pNewFrame, this); //
Both pointers are of the correct type, CMultiDocTemplate*. And both
are declared as public in the application class and initialized in
CSequApp::InitInstance() (correctly, I assume, since otherwise
the program could not have worked before, when I wrote the first
post of this thread).
I have tried other ways, and it seems that it's illegal to access those
member variables in CSequApp. If I try to assign the value in this way:
CMultiDocTemplate* pEditorTemplate =
then I get "Illegal reference to data member
in a static member function".
And it's no use defining a GetEditorTemplate() function in CSequApp,
because any calls to it seem to be illegal (still don't know why).
Those give me a "illegal call to non-static member function"
It looks like it must be a big conceptual mistake on my side, is it?