Document level events are persistent in AutoCAD VBA. That is, they are automatically enabled when a VBA project is loaded.
However, they are not enabled for any other controller, such as VB. Document level events must therefore be enabled for all other ActiveX Automation controllers.
Once the document level events are enabled, you have a wide range of events available to you. These events include
- Activate
- Triggered when a Document window is activated.
- BeginClose
- Triggered immediately after AutoCAD receives a request to close a drawing.
- BeginDocClose
- Triggered just after a request is received to close a drawing.
- BeginCommand
- Triggered immediately after a command is issued, but before it completes.
- BeginDoubleClick
- Triggered after the user double-clicks on an object in the drawing.
- BeginLISP
- Triggered immediately after AutoCAD receives a request to evaluate a LISP expression.
- BeginPlot
- Triggered immediately after AutoCAD receives a request to print a drawing.
- BeginRightClick
- Triggered after the user right-clicks on the Drawing window.
- BeginSave
- Triggered immediately after AutoCAD receives a request to save the drawing.
- BeginShortcutMenuCommand
- Triggered after the user right-clicks on the Drawing window, and before the shortcut menu appears in Command mode.
- BeginShortcutMenuDefault
- Triggered after the user right-clicks on the Drawing window, and before the shortcut menu appears in Default mode.
- BeginShortcutMenuEdit
- Triggered after the user right-clicks on the Drawing window, and before the shortcut menu appears in Edit mode.
- BeginShortcutMenuGrip
- Triggered after the user right-clicks on the Drawing window, and before the shortcut menu appears in Grip mode.
- BeginShortcutMenuOsnap
- Triggered after the user right-clicks on the Drawing window, and before the shortcut menu appears in Osnap mode.
- Deactivate
- Triggered when the Drawing window is deactivated.
- EndCommand
- Triggered immediately after a command completes.
- EndLISP
- Triggered upon completion of evaluating a LISP expression.
- EndPlot
- Triggered after a document has been sent to the printer.
- EndSave
- Triggered when AutoCAD has finished saving the drawing.
- EndShortcutMenu
- Triggered after the shortcut menu appears.
- LayoutSwitched
- Triggered after the user switches to a different layout.
- LISPCancelled
- Triggered when the evaluation of a LISP expression is canceled.
- ObjectAdded
- Triggered when an object has been added to the drawing.
- ObjectErased
- Triggered when an object has been erased from the drawing.
- ObjectModified
- Triggered when an object in the drawing has been modified.
- SelectionChanged
- Triggered when the current pickfirst selection set changes.
- WindowChanged
- Triggered when there is a change to the Document window.
- WindowMovedOrResized
- Triggered just after the Drawing window has been moved or resized.