I am creating a dockable window that allows users to select features of a particular featureclass, iterate through records in the featureclass, populate textboxes with certain attributes, and edit existing records. I am trying to keep everything within the scope of edit session.
A problem I am having is listening to editor events (edit session start/stop, selection change). I've wired up the event handlers in the Load event of the Dockable Window (DockWin) using the code below (Disclaimer, I'm an ArcObjects beginner):
Dim m_Editor As IEditor3 Dim m_EditEvents As IEditEvents_Event Public Sub New(ByVal hook As Object) ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Me.Hook = hook '--Get the editor extension. Dim editorUID As UID editorUID = New UID editorUID.Value = "esriEditor.Editor" m_Editor = (My.ArcMap.Application.FindExtensionByCLSID(editorUID)) End Sub Private Sub DockWin_Load(sender As Object, e As System.EventArgs) Handles Me.Load m_EditEvents = CType(m_Editor, IEditEvents_Event) AddHandler m_EditEvents.OnSelectionChanged, AddressOf OnSelectionChanged_Handler AddHandler m_EditEvents.OnStartEditing, AddressOf OnStartEditing_Handler AddHandler m_EditEvents.OnStopEditing, AddressOf OnStopEditing_Handler End Sub Private Sub OnSelectionChanged_Handler() MessageBox.Show("Selection Changed") End Sub Private Sub OnStartEditing_Handler() MessageBox.Show("Editing Started") End Sub Private Sub OnStopEditing_Handler() MessageBox.Show("Editing Stopped") End Sub
None of my MessageBoxes pop up, telling me it's not wired correctly. Is there anything apparently wrong with my approach? Or is there another more suitable one?
I've see that there are numerous types of selections in ArcObjects. Perhaps another is more suitable?