Hi Jan,

Composite shapes could be a nasty beast. This is a part of Roassal for which I am not even sure of which semantics if should have. So, we may end-up in some corner, as you have explained. 
However, we are luck here: this is a easy problem to solve.

The modification you wish to have, which is changing the label has to be done directly on the trachel shape and _not_ the roassal shape.
Consider this slightly modified version of the script:

-=-=-=-=-=-=-=-=-=-=-=-=
compo := RTCompositeShape new.
compo add: (RTEllipse new size: [ :tupple | tupple third ]; color: Color
lightBlue).
compo add: (RTEllipse new size: [ :tupple | tupple second ]; color: Color
blue).
compo add: (RTLabel new text: [ :tupple | tupple first ]; color: Color red).
"ADDED LINE to demonstrate it does not keep this layout: " compo vertical.

v := RTView new.

data := {{ 'hello' . 30 . 50 } . { 'World' . 20 . 70} }.
v addAll: (compo elementsOn: data).

RTHorizontalLineLayout new alignCenter; on: v elements.
v elements @ RTDraggable.

"ADDED LINE where I change labels text:" v elements do: [ :elem | |label|
label := elem trachelShape shapes third. label text: 'LABEL'. ].

v
-=-=-=-=-=-=-=-=-=-=-=-=

And just to make my email more entertaining, here is the screenshot:

Alexandre


On Mar 20, 2015, at 6:00 AM, Jan B. <bliznjan@fit.cvut.cz> wrote:

Hi, what I written is just an "how to reproduce" example, and there is of
course no need for updating.

But I think there are cases when it is, for example, edges do not update by
themselves when connected elements are changed, until we call update on
them.
In your example code, I might want to change label text (which we do, in our
application) when it is already in a view. But it does not update in view
until I call update on those composite shapes.
So I modify your code like this:
_____

compo := RTCompositeShape new.
compo add: (RTEllipse new size: [ :tupple | tupple third ]; color: Color
lightBlue).
compo add: (RTEllipse new size: [ :tupple | tupple second ]; color: Color
blue).
compo add: (RTLabel new text: [ :tupple | tupple first ]; color: Color red).
"ADDED LINE to demonstrate it does not keep this layout: " compo vertical.

v := RTView new.

data := {{ 'hello' . 30 . 50 } . { 'World' . 20 . 70} }.
v addAll: (compo elementsOn: data).

RTHorizontalLineLayout new alignCenter; on: v elements.
v elements @ RTDraggable.

"ADDED LINE where I change labels text:" v elements do: [ :elem | |label|
label := elem shape allShapes third. label text: 'LABEL'. ].
"ADDED LINE with updating:" "v elements do: [ :elem | elem update ]."

v
_____

When the elem update line is commented, labels text is not changed. When I
uncomment it, labels change to 'LABEL', but composite shapes layout is lost.
These are just few occurences when update is needed (at least I think it is)
and I am unable to find any else, but to simplify things, we just update
everything in view and it worked fine until I tried to play with composite
shapes

Jan


abergel wrote
Hi Jan,

Help me to understand what’s going on :-)

Here is a script:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
compo := RTCompositeShape new.
compo add: (RTEllipse new size: [ :tupple | tupple third ]; color: Color
lightBlue).
compo add: (RTEllipse new size: [ :tupple | tupple second ]; color: Color
blue).
compo add: (RTLabel new text: [ :tupple | tupple first ]; color: Color
red).

v := RTView new.

data := {{ 'hello' . 30 . 50 } . { 'World' . 20 . 70} }.
v addAll: (compo elementsOn: data).

RTHorizontalLineLayout new alignCenter; on: v elements.
v elements @ RTDraggable.
v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

It produces the following:



Why do you want to call #update?

Alexandre

On Mar 19, 2015, at 6:22 PM, Jan B. &lt;

bliznjan@.cvut

&gt; wrote:

Hello

I am trying to work with composite shapes, but I encountered a problem.
Let's say I need to create a circle... and in the center of it is
another,
smaller, circle with label (but I need it to be centered according to
both
label and smaller circle, that's why I decided to use composite shapes
instead of RTLabelled).
I am able to create it just fine, problem is when I call update on its
RTElement.  I'm not sure whether I am even supposed to do it, but I think
I
should be.

I start with just the inner circle with label:

| composite view |
composite := (RTLabel new
text: 'label';
yourself)
+
(RTEllipse new
size: 10;
yourself).
composite horizontal.
element := composite element.
view := RTView new.
view
add: element;
open.
element update.

Before element update, it looks fine, but when I call update, composite
layout (horizontal) gets lost.

Let's say I can ignore this problem (which I can't), and I will try the
same
thing with whole shape

| composite view subcomposite |
subcomposite := (RTLabel new
text: 'label';
yourself)
+
(RTEllipse new
size: 10;
yourself).
subcomposite horizontal.
composite := (RTEllipse new
size: 50;
color: Color transparent;
borderColor: Color black;
yourself) + subcomposite.
element := composite element.
view := RTView new.
view
add: element;
open.
element update

this time I get exception MessageNotUnderstood:
TRCompositeShape>>text:on:

I will appreciate any help, either by fixing something if it is broken,
or
explaining how to reach my goal the correct way.

Jan




--
View this message in context:
http://forum.world.st/Roassal-2-updating-CompositeShape-tp4813359.html
Sent from the Moose mailing list archive at Nabble.com.
_______________________________________________
Moose-dev mailing list


Moose-dev@.unibe

https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list

Moose-dev@.unibe

https://www.iam.unibe.ch/mailman/listinfo/moose-dev


Screen Shot 2015-03-19 at 8.42.06 PM.png (10K)
&lt;http://forum.world.st/attachment/4813417/0/Screen%20Shot%202015-03-19%20at%208.42.06%20PM.png&gt;





--
View this message in context: http://forum.world.st/Roassal-2-updating-CompositeShape-tp4813359p4813483.html
Sent from the Moose mailing list archive at Nabble.com.

_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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