This chapter describes techniques for specifying how users can interact with running simulations via a number of user interface features. The first section describes the global simulation menu and the per-object contextual menus (the section called “The Simulation Menu and Contextual Menus”). The next sections describe how to catch keyboard events (the section called “Responding to Keyboard Events”), and how to display a message using a dialog (the section called “Displaying a Dialog Box”).
While most aspects of The breve Simulation Environment function the same on all platforms, user interface is an area where the different platforms offer different levels of support. All of the techniques covered in this section may yield different results on different platforms.
The most complete support is available in the Mac OS X breve application. In addition to the techniques described above, the Mac OS X implementation also allows fully customized user interfaces to be loaded into running simulations. The section on loading "nib" files (the section called “Loading ".nib" Files for Customized Interfaces”) describes how this is done.
Menus allow users to trigger events in simulations by selecting menu items. Each simulation has a global simulation menu. This menu is associated with the controller object and is used to trigger actions which effect the entire simulation. Each object in the simulation has its own contextual menu that allows the user to trigger actions in individual instances.
For the controller object, the methods add-menu and add-menu-separator of class Control.tz are used to configure the menus. For the simulation objects, the methods add-menu and add-menu-separator of class Real.tz are used.