MVC and DynamicSashWindow
Don Dwiggins
ddwiggins at advpubtech.com
Mon Mar 5 10:53:54 PST 2007
Danny Shevitz wrote:
> I'm using a DSW to display a tree data structure. I already have a MVC
> architecture implemented, with an Observer/proxy class for my Model that runs
> underlying model methods and send messages back to the view via pubsub to notify when
> view updates are required.
>
> My Observer knows nothing about the view, it just post messages which
> the view interprets.
Your terminology confused me a bit. Usually, the model is the Subject,
and the view is the Observer.
> The wrinkle is that when I use a DSW, I don't want all the windows to do
> the same thing. In particular, I may not want to change the focus in the windows that I am not directly
> editing. Example: I insert a node in a particular window. Certainly in that window I want the selected
> item to be the new node, but in the other windows I probably want to keep the focus where it was. The
> problem is that via the mechanism I am currently using, all windows will get the message to change the focus.
Think of it a bit differently. As you said above, the model knows
nothing about the views (its observers), therefore it can't say
something like "change the focus" -- "focus" is meaningless to it. All
it can say is something like "this part of my state changed in that
way". It's up to each view to interpret that based on its own state.
--
Don Dwiggins
Advanced Publishing Technology
More information about the wxpython-users
mailing list