Hi,

this has nothing to do with Spec and all to do with Roassal.

Roassal uses it's own update mechanism, which you haven't called.


view elements when: TRMouseClick do: [ :e |
e element color: Color red. "<-- this is unrelated, but don't access
trachelShapes directly if Roassal provides API for what you want"

view signalUpdate. "<-- if you change something you need to signal the view
(and sometimes also elements) to update itself (this is useful for changing
many things without constant triggering of updates)"
].

And finally as I've said to Alex when I wrote the example which you are now
using...
DynamicComposableModel is good for scripted prototyping, but if you are
building an actual application, you should switch to ComposableModel sooner
rather than later.

Peter

On Thu, Jul 23, 2015 at 3:46 PM, Mark Rizun <mri...@gmail.com> wrote:

> Hi everyone!
>
> I'm building a ui with Spec and using Roassal view inside of my window.
> To embed the view I use Roassal2Spec package (RoassalModel class).
> When I click on element of view I want to change its color.
> The problem is that color changes only after you move a winodw or open
> another window etc.
> Here is an example code. Just try to click on elements and than move the
> window.
>
> **********************************************
>
> ui := DynamicComposableModel new.
> ui instantiateModels: #(
>         button ButtonModel
>         view RoassalModel
> ).
>
> ui button label: 'I am a button'.
> ui extent: 600 @ 480.
>
> ui view script: [ :view :canvas |
>         |es|
>         es := RTEllipse new size: 20; elementsOn: (1 to: 6).
>         view addAll: es.
>
>         RTCircleLayout on: es.
>         RTEdgeBuilder new
>                 view: view;
>                 elements: es;
>                 connectToAll: [ :value | { value + 1. (value + 1) % 6 } ].
>         view elements when: TRMouseClick do: [ :e | e element trachelShape
> color:
> Color red. World displayWorld. World doOneCycleNow ].
>         canvas camera focusOnCenter.
>
> ].
>
> layout := SpecLayout composed
>         newColumn: [ :col |
>                 col
>                         add: #button height: ComposableModel toolbarHeight;
>                         add: #view.
>         ];
>         yourself.
>
> ui openWithSpecLayout: layout.
>
> **********************************************
>
> Thanks
> Mark
>
>
>
> --
> View this message in context:
> http://forum.world.st/Spec-with-Roassal-tp4838854.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>

Reply via email to