|
-
September 13th, 1999, 04:55 AM
#1
A easy question
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!
-
September 13th, 1999, 05:06 AM
#2
Re: A easy question
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.
-
September 13th, 1999, 07:46 PM
#3
Re: A easy question
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??
-
September 14th, 1999, 04:19 AM
#4
Re: A easy question
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|