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 ;-)
On Jun 4, 2015, at 10:16, Serge Stinckwich serge.stinckwich@gmail.com wrote:
Hi all,
as you in this video, I was able to use Roassal to visualize a multi-agent simulation in a grid. https://www.youtube.com/watch?v=EXvsdL5sTRw
Now I would like to do animate the simulation without using I/O from user. I try to use the VIVA framework without any success ...
Basically, I'm doing one step of the model, modify the elements of the view and do a signalUpdate on the view.
|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: 'Greens'). c := n command: [:cells| (cells biomass)/10.0.]. b menu: 'step' 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. ]. v
Any hints ?
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/ _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
---> Save our in-boxes! http://emailcharter.org <---
Johan Fabry - http://pleiad.cl/~jfabry PLEIAD lab - Computer Science Department (DCC) - University of Chile