Hi I've been reading up on MVC recently, and it makes sense to me. Until I start to get more than one MVC triad.
After reading this: How to use Model-View-Controller (MVC)
I understand the idea of subviews and the hierarchy but in practice I'm getting confused.
Let's take a simple scenario, I have a subview (e.g. a progress bar) which is showing the progress of a file download. Obviously all the processing is being done in the related model.
Using the observer pattern, the view can be notified of updates.
This is all fine, makes perfect sense and works well.
My problem, then, is how do I put the progress % into the parent view's window title.
The window is it's own MVC triad. How does this:
Firstly, access the information of its subview (it seems that it should be reading from the model of the subview rather than the view itself). Should its own model have access to the subview's model? Should the subview have access to its parent and tell that to update when it's updated itself?
Secondly, know when to update?
I think I understand the general concept behind MVC but once I have two (or more) triads which need to share information I get confused.
Thanks for any help!
The "parent" has to have its own controller, its own listener, to listen to the model. It will respond the the listener's notification and will update accordingly.