Provides access to events that occur when the state of the active view changes.
Use this interface to listen for specific events related to the active view such as AfterDraw and SelectionChanged. A lot of CoClasses implement this interface and each of them fires events differently. For example, the Map object does not fire the FocusMap changed event whereas the PageLayout object does. Similarly, the Map object fires the item deleted event when a layer is removed from the Map and the PageLayout fires the same event when elements such as a map frame or graphic are deleted.
The following VBA script is a simple example showing one possible way an event listener can be setup:
Private WithEvents m_pActiveViewEvents As Map
Public Sub SetEvents()
Dim pMxDoc As IMxDocument
Set pMxDoc = Application.Document
Set m_pActiveViewEvents = pMxDoc.FocusMap
End Sub
Private Sub m_pActiveViewEvents_SelectionChanged()
MsgBox "Selection Changed"
End Sub
Mind which object's events you are listening for. The above sample listens for the SelectionChanged event on just the focus Map object. Changing the selection in layout view will not fire this event. Also, if the focus map changes you must reset the client.
The AfterItemDraw event will only be fired when the IViewManger::VerboseEvents property is set to True. By default this property is set to False.
| Description | ||
|---|---|---|
![]() |
AfterDraw | Fired after the specified phase is drawn. |
![]() |
AfterItemDraw | Fired after an individual view item is drawn. Example: view items include layers in a map or elements in a page layout. |
![]() |
ContentsChanged | Fired when the contents of the view changes. |
![]() |
ContentsCleared | Fired when the contents of the view is cleared. |
![]() |
FocusMapChanged | Fired when a new map is made active. |
![]() |
ItemAdded | Fired when an item is added to the view. |
![]() |
ItemDeleted | Fired when an item is deleted from the view. |
![]() |
ItemReordered | Fired when a view item is reordered. |
![]() |
SelectionChanged | Call this function to fire the selection changed event. |
![]() |
SpatialReferenceChanged | Fired when the spatial reference is changed. |
![]() |
ViewRefreshed | Fired when view is refreshed before draw happens. |
| CoClasses and Classes | Description |
|---|---|
| ActiveViewEventsListener (esriSystemUtility) | Helper coclass to provide event IActiveViewEvents support to the C++ API. |
| Adjustment (esriEditorExt) | The Adjustment Tools Editor Extension. |
| DataGraphElement (esriCartoUI) | An element of the data graph. |
| DataGraphWindow (esriArcMapUI) | Window to display Graphs. |
| Editor (esriEditor) | The Object Editor Extension. |
| FindWindowUI (esriArcMapUI) | Window to display Find dialog in. |
| Globe (esriGlobeCore) | A container for the display and manipulation of data in the Globe. |
| GlobeDisplay (esriGlobeCore) | The globe display object. |
| GraphicsLayer3D (esri3DAnalyst) | A 3D Graphics Layer. |
| LabelCache | Standard labeling label cache. |
| LabelEngine (esriTrackingAnalyst) | Controls functionality of the label engine. |
| Legend | A map surround for displaying a legend. |
| Map | A container for the display and manipulation of map data. |
| MapFrame | A graphic element for displaying maps. |
| MapInsetWindow (esriArcMapUI) | Window to display MapInsets. |
| NetworkAnalystExtension (esriNetworkAnalystUI) | |
| OverviewWindow (esriArcMapUI) | Window to display Overviews. |
| PageLayout | Page Layout class contains maps and map surrounds. |
| RealTimeFeedManager | The real-time feed manager object. |
| ReportSelection (esriArcMapUI) | Captures selection change, and reports this on the status bar. |
| Scene (esri3DAnalyst) | A container for the display and manipulation of data. |
| SceneGraph (esri3DAnalyst) | A container for recording data and events that occur in a scene. |
| SchematicExtension (esriSchematicUI) | Schematic Extension object. |
| TADynamicDisplayRefreshController (esriTrackingAnalyst) | Manages all dynamic updates to all of ArcMap's maps, both in the map view and the page layout view. |
| TOCCatalogView (esriArcMapUI) | ESRI TOC Catalog View. |
| TOCDisplayView (esriArcMapUI) | ESRI TOC Display View. |
| TOCGMxCatalogView (esriArcGlobe) | ESRI TOC GMx Catalog View. |
| TOCGMxDisplayView (esriArcGlobe) | ESRI TOC GMx Display View. |
| TOCGMxTypeView (esriArcGlobe) | ESRI TOC GMx Type View. |
| TOCSelectionView (esriArcMapUI) | ESRI TOC Selection View. |
| TOCSxCatalogView (esriArcScene) | ESRI TOC Sx Catalog View. |
| TOCSxDisplayView (esriArcScene) | ESRI TOC Sx Display View. |
| TopologyExtension (esriEditorExt) | Extension for working with topology. |
| UnplacedAnnotationWindow (esriEditor) | ESRI unplaced anno window. |