12.2. Managing Probe Displays

The appearance of the probe display can be custom-tailored by the programmer. In order to understand the effect of customization, it is probably best to begin with an understanding of the "default" appearance.

The default probe displays for a simulation can be created quite easily. In the HeatbugObserverSwarm.m file, for example, one finds these lines:


These are macro commands that cause actions inside the Swarm kernel to create the default probe displays for the model swarm and observer swarm, respectively. That is all that is required to create the default probe displays.

It might be a good exercise for the user to check this for herself. Leave those macro lines in HeatbugObserverSwarm.m, and comment out everything else to do with probes in that file and also in HeatbugModelSwarm.m. When heatbugs is executed, the user will see that the default probe display presents a list of the instance variables of the object and, if their values are set at start time, those values will be displayed as well. I need to learn how to insert a jpeg snapshot of the probe display would be included here

This bare-bones setup will not automatically update the display as the simulation proceeds. It presents only a snapshot of the creation-time settings. Many variables that have no value set before time 0 will show blanks or the word nil and that will never change.

If one wants the probe pisplay to be updated, then an update command has to be included in the schedule. In the buildActions method of HeatbugObserverSwarm.m, this is the command that will cause the updating to occur (presumably, it was commented out in the bare-bones test described above):

[displayActions createActionTo: probeDisplayManager message:

The probeDisplayManager is a global object and when it is told to update in the observer swarm's schedule, it will update the probes of objects in all other levels of the simulation.

All of this works because the Swarm kernel provides a great deal of functionality that the user may never need to inspect or worry about. Most importantly, the object probeDisplayManager is not explicitly created by the user. Rather, it appears automatically in any Swarm program that has the GUI mode turned on in its main.m. The probeDisplayManger is the object that receives messages to create displays for various objects, such as the macro statements above.

The default probe display for an object includes only the probes for the instance variables of the object. It has no buttons to click and execute methods inside the object (i.e., it has no message probes). If one wants the message probes, there are two alternatives. While the program is running, a right-click on the object's name button in the top-left part of the display will cause the message probes to be displayed. A second alternative is to change the macro used to create the probe displays. Use these macro commands instead:


This will cause the probe display to include all instance variables and methods.