ArcObjects Library Reference  (Carto)    

IActiveViewEvents Interface

Provides access to events that occur when the state of the active view changes.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use this interface to listen for specific events related to the active view, such as AfterDraw and SelectionChanged. Many CoClasses implement this interface and each fires events differently. For example, the Map object does not fire the FocusMapChanged event, whereas the PageLayout object does. Similarly, the Map object fires the ItemDeleted 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 set up:

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

Be aware of the specific object's events to which you are listening. The above sample listens for the SelectionChanged event on just the FocusMap 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 IViewManager::VerboseEvents property is set to True. By default, this property is set to False.

Members

Description
Event AfterDraw Fired after the specified phase is drawn.
Event AfterItemDraw Fired after an individual view item is drawn. Example: view items include layers in a map or elements in a page layout.
Event ContentsChanged Fired when the contents of the view changes.
Event ContentsCleared Fired when the contents of the view is cleared.
Event FocusMapChanged Fired when a new map is made active.
Event ItemAdded Fired when an item is added to the view.
Event ItemDeleted Fired when an item is deleted from the view.
Event ItemReordered Fired when a view item is reordered.
Event SelectionChanged Call this function to fire the selection changed event.
Event SpatialReferenceChanged Fired when the spatial reference is changed.
Event ViewRefreshed Fired when view is refreshed before draw happens.

CoClasses that implement IActiveViewEvents

CoClasses and Classes Description
ActiveViewEventsListener (esriSystemUtility) Helper coclass to provide event IActiveViewEvents support to the C++ API.
Adjustment (esriEditorExt) The Adjustment Tools Editor Extension.
AnimationExtension (esriAnimation) The Animation Extension Object.
CadastralEditorExtension (esriCadastralUI) Cadastral Editor Extension Object.
ControlsMapZoomToolControl (esriControls) Zooms the map by a particular percentage.
ControlsPageZoomToolControl (esriControls) Zooms the map layout by a particular percentage.
DataGraphElement (esriCartoUI) An element of the data graph.
DataGraphTElement (esriCartoUI) A container for the display and manipulation of data graph graphic element on the ArcMap layout view.
DataGraphWindow (esriArcMapUI) Window in hosting and displaying data graph.
DynamicDisplay Dynamic display class, used by the dynamic map.
Editor (esriEditor) The Object Editor Extension.
EngineInkEnvironment (esriControls) A singleton object representing Engine ink environment.
FindWindowUI (esriArcMapUI) Window to display Find dialog in. Deprecated. Please consider using the IFind interface in the Carto library instead.
FMEAnnotation (esriDataInteropUI) FMEAnnotation Class
Globe (esriGlobeCore) A container for the display and manipulation of data in the Globe.
GlobeDisplay (esriGlobeCore) The globe display object.
GlobeGraphicsLayer (esriGlobeCore) The Globe Graphics Layer.
GraphicsLayer3D (esri3DAnalyst) A 3D Graphics Layer.
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) The extension for network analysis.
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.