On Thu, Jun 4, 2015 at 3:48 PM, Johan Fabry jfabry@dcc.uchile.cl wrote:
What I would try is to take the code of the callback block for the button and fork it in a new thread. Or have the button launch the thread. e.g.:
b menu: ‘animate' background: Color red callback:[ [ |es| aModel runStep. v removeAllElements. es := (RTBox new color: c; size: 25) elementsOn: aModel theVegetationUnits. v addAll: es. RTGridLayout new gapSize:0; lineItemsCount: aModel spaceModel column; on: v elements. v signalUpdate. ] fork. ].
I have not tried this though, I’m just inventing on the fly … but I guess it should work OK. Just don’t click the button more than once ;-)
I would like to avoid fork.
I try to use VIVA and do the following, but nothing happens:
|choosenModel aModel nbSteps | choosenModel := ECEC. nbSteps := 200. aModel := choosenModel initialize;new. aModel initSimulation. v := RTView new. b := RTMenuBuilder new view:v. n := (RTMultiLinearColor new) colors: (ColorPalette sequential colors: 9 scheme: 'YlGnBu'). c := n command: [:cells| (cells biomass)/10.0.]. timer := VITimer new. timer repeat. time := VIAnimatedValue new evaluator:[:t| |es| aModel runStep. v clean. es := (RTBox new color: c; size: 25) elementsOn: aModel theVegetationUnits. v addAll: es. RTGridLayout new gapSize:0; lineItemsCount: aModel spaceModel column; on: v elements. v signalUpdate. t ]; timer: timer; yourself. time start. v addAnimation: (TRResetAllShapes new). v