Archived

This topic is now archived and is closed to further replies.

MFC Question

This topic is 5579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a class CGraphicsView, derived from CScrollView. Is there any way I could directly access its public data members from the CMyAppDoc class ( from CMyAppDoc member functions ) ?

Share this post


Link to post
Share on other sites
hmmmm, sure there''s a design pattern for this somewhere...

Why not impliment an external singleton class that gets created by the view window upon it''s creation, and has a certain amount of access to the window instance (ie, store a pointer to it). The global singleton interface would then allow some form of controlled access (ie, read "safe") that allows communication between the two....

Share this post


Link to post
Share on other sites
CView derivatives have the CDocument *GetDocument() function. Use that to obtain a pointer to your document object, re-cast it to your CDoc-derived, and use it. Assume that your CDoc have get/set function or the members are public (oh no).

[EDIT] This works only when your Doc/View 'comes in pair'.

[edited by - DerekSaw on September 3, 2002 2:43:05 AM]

Share this post


Link to post
Share on other sites