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 |
Hi, 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 <[hidden email]> wrote: Hi everyone! |
Sorry, I sent a bit wrong example. Yes I tried to use signalUpdate. However, apperently I used it somehow wrong, as it didn't work. Now it works :) Thanks
I used your example (with DynamicComposableModel) just for simplicity, because I can not show the problem in my project easily. There I use just ComposableModel. Mark |
Free forum by Nabble | Edit this page |