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:
Cameron Sanders wrote
Perhaps I am misunderstanding and solving a
different problem..
I think so :p The problem I'm having is: when I open a Magritte editor on
aParent, I get a button "Add" to add a new object to the toMany collection.
This opens up a Magritte editor on a new instance of whatever class was
selected from #classes:. My problem is that I don't know how to link this
new instance up to parent. There doesn't seem to be a hook to partially
initialize toMany objects...
-----
Cheers,
Sean
--
View this message in context:
http://forum.world.st/Default-depending-on-container-tp4712877p4713437.html
Sent from the Magritte, Pier and Related Tools mailing list archive at
Nabble.com.
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki