model changes and saved resources

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

model changes and saved resources

Jochen Riekhof
I built something roughly like the Scribble tutorial, but now need to add an
instance var to the model. This model is specified in View
class>>defaultModel. After adding the instance var, I can now no longer open
or edit my Shell and Presenter subclasses. What must i do? changing stbIO
methods or is there a simpler way?

Ciao

...Jochen


Reply | Threaded
Open this post in threaded view
|

Re: model changes and saved resources

Andy Bower
Jochen,

> I built something roughly like the Scribble tutorial, but now need to add
an
> instance var to the model. This model is specified in View
> class>>defaultModel. After adding the instance var, I can now no longer
open
> or edit my Shell and Presenter subclasses. What must i do? changing stbIO
> methods or is there a simpler way?

Youn need to add some STB conversion methods to your model class. See the
following documentation page for how to do this:

http://www.object-arts.com/Lib/EducationCentre4/htm/convertingstbdataafterin
stancelayoutchanges.htm

IIRC this page can be a little confusing so a better idea is perhaps tso
take a look at existing definitions of #stbConvertFrom: in the image to see
some examples of how to go about it.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: model changes and saved resources

Bill Dargel
In reply to this post by Jochen Riekhof
Jochen Riekhof wrote:

> I built something roughly like the Scribble tutorial, but now need to add an
> instance var to the model. This model is specified in View
> class>>defaultModel. After adding the instance var, I can now no longer open
> or edit my Shell and Presenter subclasses. What must i do? changing stbIO
> methods or is there a simpler way?

If it's just a problem with a single view resource there is a simpler way than
writing STB version conversion methods. Have the view open in the ViewComposer
when you add the instance variable to the model, then save the view in the
ViewComposer (which now holds a reference to the modified model instance).

I've never actually tried this myself, but remembered seeing it here, and found
the message by Blair McGlashan  30 Apr 2002:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=aamsfe%24bl7ud%241%40ID-50941.news.dfncis.de

Here's the relevant part:

> It may not be directly applicable in this case, but a useful trick to know
> about during development is to have any view resources containing a view one
> is about to add instance variables to (or otherwise modify) open in View
> Composers. These "running" instances will be updated by the normal
> mechanisms that the ClassBuilder uses to update existing instances when the
> shape of a class changes. One can then save down the views with the new
> shape. Obviously one must open the view resources before modifying the class
> definition, or if one forgets to do that it is probably worth reversing out
> the change temporarily so that one can load up the view resources.
>


-------------------------------------------
Bill Dargel            [hidden email]
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA