Skip to content
Advertisement

How can I have a button on the Anylogic simulation experiment page that will run the model and show the main page?

How can I have a button on the simulation experiment page that will run the model and show the main page?

I’ve seen the video “Setting up Parameters from the Experiment Page”; the Elephant model is turned on/run simply by pressing a button. How can I do this; I’ve tried a button with the action run() but this just runs the model without showing my main screen.

I know that I can just press the play button at the bottom left, but I’d like to have a button on the experiment page if possible.

Advertisement

Answer

Drag in a button and type

run();
getExperimentHost().setPresentable( getEngine().getRoot() );

The second line tells AnyLogic to actually move to your model.

Advertisement