Hello:
I have a easy question.
I use VC++6.0 .I don't know how to get the value of View class in Doc class.
Any advice!
ThankS!
Printable View
Hello:
I have a easy question.
I use VC++6.0 .I don't know how to get the value of View class in Doc class.
Any advice!
ThankS!
Attached to a document, you have a list of views... So, you have to loop through the View list and find out your own view...
CMyDocument::XXX()
{
POSITION pos=GetFirstViewPosition;
while (pos)
{
CView* pView=GetNextView(pos);
}
}
Easy, isn't it?
Thierry.
Thank you.
But like your advice .
I defined a int MyData in my view class *.h and it is public.
I want to change MyData's value in Doc class.but the pView->can't
do it.Why?
Any advice??
POSITION pos=GetFirstViewPosition();
while (pos)
{
CView* pView=GetNextView(pos);
if (pView->IsKindOf(RUNTIME_CLASS(CMyViewClass))
((CMyViewClass*)pView)->m_nMyData=15;
}
This portion of code is only valid if you have one instance of your view class. If you have more than one instance of that view class, you need more information to differentiate between them
(other data member, for example...)
Thierry.