Dolphin 4 MVC problems

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

Dolphin 4 MVC problems

plewis66
I have downloaded Dolphin 4.0 Standard.
The first is that I am a complete novice, so I might not explain myself
well...
The other is that I have developed a simple MVC triad in Dolphin
Summer99 edition (the free one), which works fine. However, when I
import my package into Dolphin 4.0 and try it there, the model is
updated by activity in the view (changing a number for example), but
the view is never updated by changes in the model.
It is precisely the same code in both cases.
I tried to trace the events when the model changes, but I am too new to
Smalltalk to understand all the stuff about Mutex's that it seems to go
through.

Any ideas very gratefully received.


Sent via Deja.com http://www.deja.com/
Before you buy.


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin 4 MVC problems

Andy Bower
Phil,

> I have downloaded Dolphin 4.0 Standard.
> The first is that I am a complete novice, so I might not explain myself
> well...
> The other is that I have developed a simple MVC triad in Dolphin
> Summer99 edition (the free one), which works fine. However, when I
> import my package into Dolphin 4.0 and try it there, the model is
> updated by activity in the view (changing a number for example), but
> the view is never updated by changes in the model.
> It is precisely the same code in both cases.
> I tried to trace the events when the model changes, but I am too new to
> Smalltalk to understand all the stuff about Mutex's that it seems to go
> through.

Yes, tracing through all that event stuff can be really confusing!

The free version of Dolphin is quite some way behind the commercial version
and I guess that it is these differences that will be causing problems. Your
particular problem is probably caused by the way that view connect to their
models. In Dolphin 2.1 this was performed in a #model: method on the view,
such as:

BasicListAbstract>>model: aListModel
    "Connect the receiver to aListModel"
    super model: aListModel.
     aListModel
          when: #listChanged send: #onListChanged to: self;
          when: #item:addedAtIndex: send: #onItem:addedAtIndex: to: self;
          when: #itemRemovedAtIndex: send: #onItemRemovedAtIndex: to: self;
          when: #itemUpdatedAtIndex: send: #onItemUpdatedAtIndex: to: self.

In Dolphin 4.0 this has been rationalised so that there is only one #model:
method on the view side (View>>model:) and this calls #connectModel: to do
the work of registering the view's interesting in the model's events. Hence
what you need is to override #connectModel to do what #model: use to do:

e.g.

BasicListAbstract>>connectModel: aListModel
    "Connect the receiver to aListModel"
     aListModel
          when: #listChanged send: #onListChanged to: self;
          when: #item:addedAtIndex: send: #onItem:addedAtIndex: to: self;
          when: #itemRemovedAtIndex: send: #onItemRemovedAtIndex: to: self;
          when: #itemUpdatedAtIndex: send: #onItemUpdatedAtIndex: to: self.

Do a browse for all definitions of #model and (on the view side only)
convert these to #connectModel: methods. I noticed just now that this change
is not mentioned in the release notes (which it quite plainly should be) so
thanks for bringing this to our attention.

I'm not sure about your package load problems. As I said these could be
caused by a number of differences in 4.0 compared with 2.1. If you continue
to have problems please post more details to the newsgroup.

Best regards,

Andy Bower
Dolphin Support
http://www.object-arts.com

---
Visit the Dolphin Smalltalk Wiki Web
http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: Dolphin 4 MVC problems

Andy Bower
Folks,

Sorry, that should have been #connectModel (no parameter) rather than
#connectModel:.

So take a look at BasicListAbstract>>connectModel (in Dolphin 4) at it
reads:

BasicListAbstract>>connectModel
     "Connect the receiver to it's model, wiring events etc."
    self model
           when: #listChanged send: #onListChanged to: self;
           when: #item:addedAtIndex: send: #onItem:addedAtIndex: to: self;
           when: #itemRemovedAtIndex: send: #onItemRemovedAtIndex: to: self;
           when: #itemUpdatedAtIndex: send: #onItemUpdatedAtIndex: to: self.


Best regards,

Andy Bower
Dolphin Support
http://www.object-arts.com

---
Visit the Dolphin Smalltalk Wiki Web
http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
---