huangs3

Attribute Window is not refreshed after programatically clearing selections.

Discussion created by huangs3 on Feb 26, 2013
Latest reply on Feb 27, 2013 by ldonahue
Hi Everybody:

    I am using an event handler to automatically clear all the selections when a point in a specific layer is created. The clearing works for the attribute table of the layer and the selection on the map. However, the clearing doesn't work with the Attribute Window of the editor. This causes a strange state after the point is created: nothing is selected on the map (no blue highlight), but the Attribute Window tree view shows a newly created point feature.
    Why does this happen? How to synchronize the tree view in Attribute Window?
    Thank you!

// * this event handler is re-attached to the IEditEvents_Event.OnSelectionChanged of the ArcMap editor extension, every time
//    when a point of a specific layer is created.
// * This function is called when an edit session is started.
// * m_application is the IApplication of the ArcMap, and m_editor is the running editor extension
void Extension_OnSelectionChanged()
{
    (m_editor as IEditEvents_Event).OnSelectionChanged -= Extension_OnSelectionChanged
    ((m_application.Document as IMxDocument).FocusMap as IMap).ClearSelection();
    ((m_application.Document as IMxDocument).FocusMap as ISelectionEvents).SelectionChanged();
}

Outcomes