anylogic

Is there a function in AnyLogic to display an alert message during model run?


I would like to display some text in an alert box similar to what the error() and errorInModel() methods create, but not as an error, just a simple message. I searched for a built-in method in the Help, but couldn't find anything.

It's not intended for an end user, just for myself as an alternative to printing to console during debugging.


Solution

  • Actually, there is a way to display a message box by using IExperimentHost API functions:

    getExperimentHost().showMessageDialog( "My info message" );
    getExperimentHost().showErrorDialog( "My error message" );
    

    Check out API reference: https://anylogic.help/api/com/anylogic/engine/gui/ExperimentHost.html#showmessagedialog