Hi Alex,
On Sat, Jul 25, 2015 at 10:02 PM, Alexandre Bergel <alexandre.bergel(a)me.com>
wrote:
Hi Peter!
Basically I want to have either:
a) option to execute behavior when element is added to view --- this is
basically
direct counterpart to TRRemovedCallback.
So I could do things like...
element addCallback: (TRAddedCallback: [ :shape | "add dependent
elements or
whatever" ]).
Sure, easy. I have just committed this. Update Trachel and you can do
(this is a test I wrote):
Excellent, thank you!
b) have RTInteractions be lazily initialized ---
only after the element
has been added to the view.
(or both)
This is a bit more problematic. I am not sure about it.
The idea is to have more clearly resolvable
interactions like
RTLabelled, which currently requires for the element to be
already in the
view.
I'm not sure if the second option will be
entirely feasible, because
many of the interactions are stateless and require
immediate evaluation...
but that could be resolved with some flags or different subclassing or
something...
Is it possible for you? Is this something you want in Roassal?
Are these lazy interactions something you need just for the added
callback? Or is it something you need for other needs?
TRAddedCallback is generic so I can easily use it for lazy interactions...
imagine for example
RTLabelled>>initializeElement: anElement
anElement view
ifNil: [ anElement addCallback: (TRAddedCallback: [ :evt | self
lazyInitializeElement: anElement ]) ]
ifNotNil: [ self lazyInitializeElement: anElement ]
and then you can remove the el view ifNil: [ self error: 'You are trying to
use RTLabelled ].error checking.
So TRAddedCallback is good for both scenarios.
Thank you!!
Peter