I think I understand. Unfortunately, I am going to need help with one more thing. As I said, I need to edit this label pretty often. Let's say I edited this label... or some other inner shape of composite shape... therefore it changed its extent. How to properly update the composite shape layout? Consider following code:
| compo elem v | (compo := RTCompositeShape new) add: (RTLabel new text: 'a string'; color: Color red); add: (RTEllipse new size: 20; color: Color blue); horizontal; setAutomaticRelayout. "just tried what it will do" elem := compo element. (v := RTView new) add: elem; open. elem trachelShape shapes first text: 'quite longer string'. v
Layout is set according to size of original string, so the longer string interferes with ellipse. What is the best way (if there is any), to keep same distance between these inner shapes?
Jan
abergel wrote
hi!
Actually no. Updating the visualization should be done by manipulating trachel shapes. Roassal shapes are good to create elements. Once an element has been created, modifying its shape should not result in an update of the visualization. Because there are some case where one do not want this.
Modifying a visualization should be done by modifying trachel shapes. Or building appropriate Roassal interactions.
I agree with you, this is not an easy things to grasp.
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Mar 20, 2015, at 7:35 PM, Jan B. <
bliznjan@.cvut
> wrote:
Yes, it fully works even in our app this way. Thank you. Just to understand it correctly, is this avoiding of using update by getting trachelShape just workaround of a problem with composite shapes, right? Should update on composite shapes work in perfect world, and I could use it without any possible problem, yes?
Jan
abergel wrote
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
-- View this message in context: http://forum.world.st/Roassal-2-updating-CompositeShape-tp4813359p4813737.ht... Sent from the Moose mailing list archive at Nabble.com. _______________________________________________ Moose-dev mailing list
Moose-dev@.unibe
Moose-dev mailing list
Moose-dev@.unibe
-- View this message in context: http://forum.world.st/Roassal-2-updating-CompositeShape-tp4813359p4814664.ht... Sent from the Moose mailing list archive at Nabble.com.