Archived

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

MFC FormView Question

This topic is 6020 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 don''t know if this belongs here or in the platform specific forum, so if this isn''t appropriate i''ll be happy to put it there. Anyway, on to my question. I have two different form views in my app (on the screen at the same time thanks to splitters). When I press a pushbutton on one form it needs to check the states of checkbox''s on the other. IsDlgButtonChecked() isn''t working. It isn''t generating any errors or warnings. Any thoughts; Prairie

Share this post


Link to post
Share on other sites
Multiple views basically have no way of talking to each other in standard doc/view architecture.

There are a few ways you can do this. One is to ask the document to send an update method to everyone, and to keep a copy of what''s supposed to be happening in the document (the document is, after all, supposed to be responsible for storage of all actual data). A second is to always tell the document when the state changes, so that the document always knows exactly what the second view knows. Another is to call a function in the document written for the express purpose of sending a message to the first view telling it the current state of the second view. I guess you could also give the "master" view knowledge of the other view, but that''s technically a violation of the architecture and I wouldn''t suggest it.

I suggest that you keep a list of the states from the second form in the document, and inform the document of any state changes, that way when you push the button you merely retrieve the data from the document. That sounds like the simplest implementation of this particular problem to me.

-fel

Share this post


Link to post
Share on other sites