[Seaside] newbie design question
avi.bryant at gmail.com
Sun Jul 3 15:55:38 CEST 2005
On Jul 3, 2005, at 3:49 PM, Jamie Ashford wrote:
> Thanks Avi.
> I'm going to use the onAnswer method initially and then consider
> refactoring the code and introducing a domain model.
> One problem that I did encounter with onAnswer (and this may just be
> due to my limited understanding of smalltalk) was that:
> comp1 := Comp1 new onAnswer: [:val | self selected: val].
> did not work. It changed comp1 to be of type WAAnswerHandler and would
> not render.
Oh. Yeah, sorry. The return value of onAnswer: is the handler, not
self as I had thought. That was sloppy of me - if you're
initializing an object as you create it like that, the best practice
is to end things with a cascade to #yourself, like this:
comp1 =: Comp1 new
onAnswer: [:val | self selected: val];
More information about the Seaside