Hi, this is a little more difficult to answer than yes or no.
Your solution fixes the problem described by me, but it is not so useful for
our needs, because...
Calling addCallbackToAllShapes: instead of addCallback:, like with all other
shapes we use, means to make exceptions just for composite shapes. Right now
we add same callbacks to all our shapes the same way on one place, but with
this change we probably will have to either type check in all places we add
callbacks or create even more code and make it all more difficult to
maintain, because we add those callbacks pretty far from place we create
shapes...
I thought about subclassing TRCompositeshape and rewriting addCallback: to
affect all our shapes, but we use also TRRemoveCallbacks, and those need to
be triggered only once, because we use them to remove our labels of edges...
if we trigger such TRRemoveCallback when labels were already removed before,
by callback from previous subshape, error occurs.
This last problem with multiple calling remove callbacks, is, by the way,
happening even now, because TRCompositeShape>>remove calls remove callbacks
twice for first subshape... one from triggerRemoveCallbacks, second from the
loop calling remove on all subshapes, as we discussed in TRCompositeShape
regression thread:
http://forum.world.st/Roassal-TRCompositeShape-regression-td4816726.html
So what we do now is use old version of trachel and do not explicitely use
composite shapes anymore.
Jan
abergel wrote
Hi Jan!
Is the problem you described below still an issue?
(I am going through marked emails)
Cheers,
Alexandre
> On Apr 8, 2015, at 2:58 PM, Jan B. <
bliznjan@.cvut
> wrote:
>
> Hi
>
> This method does what I want and it works just fine. Only problem is that
> we
> add callbacks to all shapes in one place the same way, but this requires
> exception for composite shapes.
>
> It seems composite shapes need different behavior with different usage of
> them. I thought about using replacable blocks for composite shapes
> actions
> like adding callbacks, resizing or moving composite shape, reaction to
> moving or resizing sub-shapes etc.
>
> I will try to unify discussion about composite shapes into "Roassal
> TRCompositeShape regression" thread started by Peter.
>
> Jan
>
>
> abergel wrote
>> Hi Jan,
>>
>> I have a solution for your problem (you need to update Roassal). Let’s
>> see
>> whether it works for you.
>>
>> Here is an updated version of your script:
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> s := RTCompositeShape new.
>> s add: (RTBox new color: Color blue; size: 50).
>> s add: (RTEllipse new color: Color green; size: 100).
>> s horizontal.
>> s setAutomaticRelayout.
>>
>> e := s element.
>> view := RTView new.
>> view add: e.
>>
>> e @ RTDraggable.
>>
>> encompass := RTBox new color: Color transparent; borderColor: Color
>> red;
>> element.
>> view add: encompass.
>>
>> block := [ encompass extent: e encompassingRectangle extent;
>> translateTo:
>> e
>> position. view signalUpdate. ].
>>
>> “I have introduced #addCallbackToAllShapes:"
>> e trachelShape addCallbackToAllShapes: (TRExtentCallback block: block).
>> e trachelShape addCallbackToAllShapes: (TRTranslationCallback block:
>> block).
>> block value.
>>
>> e when: TRMouseClick do: [ :ev |
>> e trachelShape shapes second extent: 20@20.
>> view signalUpdate.
>> ].
>>
>> view open
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> Let us know about your progresses!
>>
>> Alexandre
>
>
>
>
>
> --
> View this message in context:
>
http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814…
> Sent from the Moose mailing list archive at
Nabble.com.
>
> _______________________________________________
> Moose-dev mailing list
>
Moose-dev@.unibe
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Moose-dev mailing list
Moose-dev@.unibe
--
View this message in context:
http://forum.world.st/Roassal-TRCompositeShape-not-sending-callbacks-tp4814…
Sent from the Moose mailing list archive at
Nabble.com.