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]"
<ml-node+s1294792n4713449h7(a)n4.nabble.com>
Date: 10/09/2013 10:35 AM (GMT-05:00)
To: "Sean P. DeNigris" <sean(a)clipperadams.com>
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:
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
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/Default-depending-on-container-tp4712877p4713449.html
To unsubscribe from Default depending on container, click here.
NAML
-----
Cheers,
Sean
--
View this message in context:
http://forum.world.st/Default-depending-on-container-tp4712877p4713571.html
Sent from the Magritte, Pier and Related Tools mailing list archive at
Nabble.com.