[wxPython-users] Re: MVC and DynamicSashWindow

Danny Shevitz shevitz at lanl.gov
Mon Mar 5 12:21:45 PST 2007


thank you for your response. You have helped me.

Perhaps I have not been consistent with common parlance. My architecture is 
a gui, with no functionality that I call the View. I have code
that proceses user events and changes the display state of the gui that I 
call the Controller.
I have a Model class that represents the underlying tree data. I also have
a proxy class that is called by Controller, runs underlying Model calls and 
broadcasts change view messages to the Controller, that I call the 
Observer. I hope
this agreed upon nomenclature, but if it isn't, I can change it.

Anyway your suggestion can be rephrased as: Have the proxy broadcast the 
same view change messages to all DSW Controllers,
but the innovation is to have the Controllers have a state such as 
"CurrentlySelected" and only respond to a Select Item message if you are
"CurrentlySelected".

That suggestion is a good one, and I probably implement it.

thanks,
Danny

At 10:53 AM 3/5/2007 -0800, you wrote:
>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
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
>For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org





More information about the wxpython-users mailing list