Sign in to follow this  
Ninkazu

MFC MDI question

Recommended Posts

I'm writing a map editor and already have the view structure set up, but I want all the data to be handled by the document structure. How do I pass the document data to the view so the map can be rendered as well as serialized through the document? My code so far: http://www.venosoft.com/uploads/njedit.zip I know it isn't much, but I don't want to get so deep that it's impossible to change.

Share this post


Link to post
Share on other sites
Well, when your CMyView::OnDraw(CDC * pDC) function gets called, you can just do CMyDocument * Document = GetDocument();. IIRC the MFC app wizard generates this for you, something like this:

void CMyView::OnDraw(CDC* pDC)
{
CMyDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

}

Then you just draw whatever from the data in pDoc to pDC.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this