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 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. Objects in the simulation each have their own contextual menus which allows the user to trigger actions in individual instances.
For the controller object, the methods add-menuadd-menu-separator of class Control.tz are used to configure the menus. For the simulation objects, the methods add-menuadd-menu-separator class Real.tz are used.