Attribute Editor Changes

501
6
Jump to solution
05-17-2018 06:18 AM
MKa
by
Occasional Contributor III

Is there a way for my onRowChangeEvent(RowChangedEventArgs args) to determine if a change came from the ArcGIS Pro attribute editor specifically?  I want to allow users to change the shape, scale, and location of objects, but not alter the attributes using the out of the box editor.  I have come up with a number of work arounds, but wondering if I am missing something that says the change came from map/attribute editor/etc...

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Its the internal inheritance. "IsMove" isn't on the basetype but you can still get it from the instantiated type.

      var ismprop = activeTool.GetType().GetProperty("IsSketchModified", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Instance);
      var improp = activeTool.GetType().GetProperty("IsMove");

View solution in original post

0 Kudos
6 Replies
by Anonymous User
Not applicable

No, there's no way to determine where the change came from for the row changed events.

To lock down the attributes you could set them to 'read-only' in the layer's field definition. 

0 Kudos
MKa
by
Occasional Contributor III

Is there a way to see this data in code for the FrameworkApplication.ActiveTool?  I think if I can cast the ActiveTool to ModifyFeatureTool, I could get what I want from the IsSketchModified field.  But I can't find a way to get this.  I have been debugging, and I am finding that the IsSketchModified is true for any shape changes, and false for attribute only.  This would do it for me, but can't find a way to get from ActiveTool to ModifyFeatureTool.

0 Kudos
by Anonymous User
Not applicable

You could use reflection but now you're getting into unsupported territory.

      //get current tool
      var activeTool = FrameworkApplication.ActiveTool;
      var currentTool = FrameworkApplication.CurrentTool;
      var ismprop = activeTool.GetType().BaseType.GetProperty("IsSketchModified", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
      if (ismprop != null)
      {
        Debug.WriteLine(ismprop.GetValue(activeTool).ToString());
      }
0 Kudos
MKa
by
Occasional Contributor III

that is the type of thing I want.  But i also want Move/Rotate/Scale values.  I cant seem to get the binding flags right, it keeps turning up null?

var activeTool = FrameworkApplication.ActiveTool;
var currentTool = FrameworkApplication.CurrentTool;

var isMoveProp = activeTool.GetType().BaseType.GetProperty("IsMove", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty);
0 Kudos
by Anonymous User
Not applicable

Its the internal inheritance. "IsMove" isn't on the basetype but you can still get it from the instantiated type.

      var ismprop = activeTool.GetType().GetProperty("IsSketchModified", BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Instance);
      var improp = activeTool.GetType().GetProperty("IsMove");
0 Kudos
MKa
by
Occasional Contributor III

In order to get that the shape changed from either vertices/delete/reshape you can use the arg on Module to get the difference in the shape.  In order to do this in the OnRowChange Event you need to get both the OriginalGeometry and the NewGeometry first.  You can compare them using .equals to get that change.  In order to detect a move/rotate/scale, you will need to use the above methods to find out if IsSketchModified, IsMove, IsRotate, or IsScale is true.  If these conditions are false, then you can assume that the change came from the OOB Attribute Editor.  

0 Kudos