The AutoCADET's Guide to Visual LISP: Optimize and Customize Your AutoCAD Design Environment

After you are comfortable writing Visual LISP functions based on command type structures and dialog boxes, you are ready to begin exploring the next level of interactive programming: event-based programming. Event-driven programs respond to things as they happen in the computer and thereby represent a high degree of integration between the application and AutoCAD. Event-driven programs consist of a set of reactor functions. Each function will react to a particular event in the system.
Event programming is not well suited for all applications and can be difficult to pull off correctly using Visual LISP. So, although you explore the concepts behind events and writing programs for them in this chapter, keep in mind that the best strategy is to start with simple concepts and be pleasantly surprised as they evolve into a deeply integrated application.
An event is something noteworthy that is happening in the computer, such as opening a new file or adding an entity object to a drawing. Some applications may want to know about these sorts of things going on in the computer, and it is through events that an application learns of them.
The supplier of the environment determines exactly what events are considered noteworthy. In Visual LISP, the environment is AutoCAD, so Autodesk has determined which the events you can be notified about. Events occurring at the Windows level are not exposed to Visual LISP because they are generally not important to AutoCAD-based applications. (If they are important, you must use C++...