Ah yes. Thank you. Of course that's exactly where I should've looked! Still sometimes forget that I can dig into any part of a Smalltalk system and find answers for myself ;)
-------- Original message --------
From: "DiegoLont [via Smalltalk]" <[hidden email]>
Date: 10/09/2013 10:35 AM (GMT-05:00)
To: "Sean P. DeNigris" <[hidden email]>
Subject: Re: Default depending on container
Hi Sean,
I think I understand your problem. You need to create your custom ToManyComponent and override the "add" message. The basic implementation is:
add
self root
show: (self validatedFormOn: self selected new)
onAnswer: [ :result |
result isNil
ifFalse: [ self value: (self value copyWith: result); refresh ] ]
The "self selected new" you want to change into something you want. Perhaps it would be nicer if this is replaced by a hook, having the default implementation of add:
add
self root
show: (self validatedFormOn: self newInstance)
onAnswer: [ :result |
result isNil
ifFalse: [ self value: (self value copyWith: result); refresh ] ]
newInstance
^self selected new
And then override the newInstance. But in all cases you need a custom ToManyComponent that makes sure it creates the correct instance.
Cheers,
Diego
On Oct 9, 2013, at 2:04 PM, Sean P. DeNigris wrote: