Roassal addedIn event

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal addedIn event

Peter Uhnak
Hi Alex,

I've mentioned this very long time ago, but it wasn't on my radar so I get back to it just now.

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" ]).

or 

b) have RTInteractions be lazily initialized --- only after the element has been added to the view.

(or both)


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?

Thanks,
Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal addedIn event

abergel
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):
-=-=-=-=-=-=-=-=-=
testAddingCallback
        | t c s canvas |
        t := OrderedCollection new.
        c := TRAddedCallback new.
        c block: [ :aShape | t add: aShape ].
        self assert: t isEmpty.
       
        s := TRBoxShape new size: 30.
        s addCallback: c.
        self assert: t isEmpty.
       
        canvas := TRCanvas new.
        canvas addShape: s.
        self deny: t isEmpty.
        self assert: t size equals: 1.
        self assert: t anyOne equals: s
-=-=-=-=-=-=-=-=-=

> 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?

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal addedIn event

Peter Uhnak
Hi Alex,

On Sat, Jul 25, 2015 at 10:02 PM, Alexandre Bergel <[hidden email]> 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






_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal addedIn event

abergel
Okay!

Alexandre


> On Jul 25, 2015, at 10:46 PM, Peter Uhnák <[hidden email]> wrote:
>
> Hi Alex,
>
> On Sat, Jul 25, 2015 at 10:02 PM, Alexandre Bergel <[hidden email]> 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
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev