Provides access to events that occur with an object class.
Implementing IObjectClassEvents allows for the building of ClassExtensions which is an ideal way to extend the default geodatabase behavior. By implementing the IObjectClassEvents interface you can capture events that occur in the object class. These events include when a new object is created in the class, an object in the class is modified, or an object in the class is deleted. This type of ClassExtension can be used when you don't want to rely on catching IEditEvents such as OnCreateFeature, OnChangeFeature or OnDeleteFeature. This is handy when you need to implement a geodatabase-level customization that will not be application specific, i.e. dependent upon ArcMap and the Editor extension.
| Description | ||
|---|---|---|
![]() |
OnChange | This event is fired when an object's attributes or geometry is updated. |
![]() |
OnCreate | This event is fired when a new object is created in the object class. |
![]() |
OnDelete | This event is fired when an object is deleted from the object class. |
| CoClasses and Classes | Description |
|---|---|
| AnnotationFeatureClassExtension (esriCarto) | An ESRI annotation feature class extension. |
| DimensionInspector (esriEditor) | A property inspector for dimension features. |
| FDOGraphicsLayer (esriCarto) | A collection of properties for an annotation layer (feature data object graphics layer). |
| FeatureInspector (esriEditor) | Default feature inspector for the Editor. |
| FeatureSnap (esriEditor) | Snap agent that snaps to a feature in a specified way. |
| ForceElementLayer (esriMOLE) | A custom layer, bound to a feature layer, that wraps a force element display list and makes it possible to view and manipulate its cached graphic contents in an ArcGIS map display. |
| GxRasterCatalogContentView (esriCatalogUI) | The RasterCatalog content view. |
| ObjectClassEvents | Helper coclass for working with the outbound interface on noncreatable object classes in VB. |
| ObjectClassEventsListener (esriSystemUtility) | Helper coclass to provide IObjectClassEvents support to the C++ API. |
| RelQueryTable | An object that joins two datasets based on common data values. |
| RouteEventSource (esriLocation) | Route event source object. |
| TacticalGraphicLayer (esriMOLE) | A custom layer, bound to a feature layer, that wraps a tactical graphic display list and makes it possible to view and manipulate its cached graphic contents in an ArcGIS map display. |
| TopologyExtension (esriEditorExt) | Extension for working with topology. |
| XYEventSource | XY event source object. |
If you are using the OnCreate, OnDelete or OnChange methods in a class extension to validate edit operations, you should not call AbortEditOperation on the workspace if your logic indicates that the edit operation is invalid. Instead, raise an error which will be propagated to the application that is performing the edit on the class.
It is the responsibility of the editing application that receives the error to abort the edit operation. This is especially true when editing with ArcMap. If you call AbortEditOperation from within the class extension, the ArcMap undo/redo edit stack will become out of sync.
In the event that a feature should be deleted due to an OnChange event, it is not recommended that the event handler delete the feature itself. Instead, an exception should be thrown to the application, where it can be made responsible for deleting the feature.
The OnCreate, OnDelete or OnChange events are not fired during a Topology Validation. The OnCreate and OnDelete events are not applicable since a Validate does not create or delete features. The OnChange event is not fired for performance as a large number of features may be changed during a Validate. In addition, features may be changed many times.
Private Const E_FAIL As Long = -2147467259
Private Sub IObjectClassEvents_OnChange(ByVal obj As esriGeoDatabase.IObject)
Dim pFeature As IFeature
Set pFeature = obj
If "your validation code here" Then
Err.Raise E_FAIL,,"Invalid feature"
End If
End Sub