com.esri.arcgis.arcmapui
Interface IDocumentEventsDisp

All Superinterfaces:
EventListener, Serializable
All Known Implementing Classes:
IDocumentEventsDispAdapter, IDocumentEventsDispProxy

public interface IDocumentEventsDisp
extends EventListener, Serializable

Provides access to events that occur in ArcMap.

Remarks

When you are working in VBA, the IDocumentEventsDisp interface is automatically exposed for you. There is a MxDocument object defined in the ThisDocument class module. Select that object in the Object Box on the ThisDocument code window and then you can choose any of its events by clicking in the Procedure/Method Box on the ThisDocument code window. This stubs out the event procedures and you can write your code here.

In ArcMap there can be up to three VBA projects (Project, TemplateProject, and Normal) loaded and each one has a ThisDocument class module. You can write code for each document event in each ThisDocument code window. It is important to know the order in which the document events for each VBA project get fired. For example, when the NewDocument event occurs, the code in the MxDocument_NewDocument function in Project.ThisDocument executes first, then in TemplateProject.ThisDocument, and finally in Normal.ThisDocument.

If an event function in Project.ThisDocument returns True, then the code for this event in TemplateProject.ThisDocument and Normal.ThisDocument does not get executed. This provides a mechanism for a document to override any code that might be in the base template or the Normal template.

When To Use

Use the IDocumentEventsDisp interface to perform some action when the ArcMap document events occur.

Product Availability

Available with ArcGIS Desktop.


Method Summary
 boolean activeViewChanged(IDocumentEventsDispActiveViewChangedEvent theEvent)
          Fired when the active view has changed.
 boolean beforeCloseDocument(IDocumentEventsDispBeforeCloseDocumentEvent theEvent)
          Fired before a document is closed.
 boolean closeDocument(IDocumentEventsDispCloseDocumentEvent theEvent)
          Fired when a document is closed.
 boolean mapsChanged(IDocumentEventsDispMapsChangedEvent theEvent)
          Fired when a change is made to the map collection.
 boolean newDocument(IDocumentEventsDispNewDocumentEvent theEvent)
          Fired when a new document is created.
 boolean onContextMenu(IDocumentEventsDispOnContextMenuEvent theEvent)
          Indicates if a context menu should be displayed at the given xy location.
 boolean openDocument(IDocumentEventsDispOpenDocumentEvent theEvent)
          Fired when a document is opened.
 boolean vBAReset(IDocumentEventsDispVBAResetEvent theEvent)
          Fired when VBA is reset.
 

Method Detail

activeViewChanged

boolean activeViewChanged(IDocumentEventsDispActiveViewChangedEvent theEvent)
                          throws IOException,
                                 AutomationException
Fired when the active view has changed.

Remarks

There are two different view types in ArcMap--data view and page layout view. Only one type of view can be active in the application at a time; the one with the focus is the active view. The ActiveViewChanged event occurs when the active view is changed. For example, this event is fired when ArcMap is switched from data view to page layout view or vice versa.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

mapsChanged

boolean mapsChanged(IDocumentEventsDispMapsChangedEvent theEvent)
                    throws IOException,
                           AutomationException
Fired when a change is made to the map collection.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

onContextMenu

boolean onContextMenu(IDocumentEventsDispOnContextMenuEvent theEvent)
                      throws IOException,
                             AutomationException
Indicates if a context menu should be displayed at the given xy location. Return true if handled.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The handled
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

newDocument

boolean newDocument(IDocumentEventsDispNewDocumentEvent theEvent)
                    throws IOException,
                           AutomationException
Fired when a new document is created.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

openDocument

boolean openDocument(IDocumentEventsDispOpenDocumentEvent theEvent)
                     throws IOException,
                            AutomationException
Fired when a document is opened.

Remarks

This event occurs when a document is opened in ArcMap.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

closeDocument

boolean closeDocument(IDocumentEventsDispCloseDocumentEvent theEvent)
                      throws IOException,
                             AutomationException
Fired when a document is closed.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

beforeCloseDocument

boolean beforeCloseDocument(IDocumentEventsDispBeforeCloseDocumentEvent theEvent)
                            throws IOException,
                                   AutomationException
Fired before a document is closed. Return True to abort the close process.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The abortClose
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

vBAReset

boolean vBAReset(IDocumentEventsDispVBAResetEvent theEvent)
                 throws IOException,
                        AutomationException
Fired when VBA is reset.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Parameters:
theEvent - The event
Returns:
The bStop
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.