vlr-acdb-reactor creates a database reactor, vlr-toolbar-reactor creates a toolbar reactor, and so on. Except for object reactors, the reactor creation functions require the following arguments:
You link a callback function to an event when you create a reactor. There is an AutoLISP function for creating each type of reactor. These functions have the same name as the reactor type, minus the leading colon. For example,saveDrawingInfo function in response to a user issuing a SAVE command:
For example, the following command defines a DWG Editor reactor. The reactor will invoke the(vlr-dwg-Reactor nil '((:vlr-saveComplete . saveDrawingInfo)))
nil because there is no application-specific data to attach to this reactor. The second argument is a list consisting of dotted pair lists. Each dotted pair list identifies an event the reactor is to be notified about, and the callback function to be run in response to that event. In this case the reactor is notified of only one event, :vlr-saveComplete.
In this example, the first argument issave-drawingInfo simply checks for the Save command.
Editor reactors are notified each time the user issues a command, whether through the AutoCAD command line, a menu, a toolbar, or an AutoLISP program. So, the callback function for this DWG reactor needs to determine precisely what it is responding to. In the current example,vlr-DWG-reactor.
Possible events for each reactor type are listed in the AutoLISP Reference. To find the list of events for a reactor, refer to the entry in the AutoLISP Reference that describes the function used to create the reactor. For example, to find the list of possible events for a DWG reactor, refer to the entry forAll reactor construction functions return a Reactor object.