Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

ArcObjects SDK for .NET and ArcGIS 10 Desktop

Quick snippet to set the stage:

IEditor3 editor.StartOperation();  
IFeature newFeature;
// fill out newFeature.Shape, etc.
newFeature.Store();
editor.StopOperation("Adding new feature");

At this point I'd like to automatically "show" the attributes for this new feature in the Attribute display/table, which could be visible alongside the Create Features template list.

Equivalent process through ArcMap itself:

  • Start the Editor via the Editor Toolbar.
  • Click a feature template from the Create Features list.
  • Click the Attributes button to open the Attributes display.
  • Mouse-down in ArcMap. See new/default attributes for the new feature be displayed in the Attributes table area.

Is the possible with ArcObjects for .NET?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

You can execute the command to show the window yourself as in the code below:

    var document = _app.Document;  // _app is an IApplication reference
    var uid = new UIDClass { Value = "esriEditor.AttributionCommand" };
    var item = document.CommandBars.Find(uid, false, false);

    item.Execute();

Edit: then, to view the feature in the Attributes window, you would add it to its layer selection set (via the layer's IFeatureSelection interface). You will also need to notify ArcMap about the selection change - call IFeatureSelection.SelectionChanged, followed by ISelectionEvents.SelectionChanged (you would obtain ISelectionEvents by casting from the Map class).

share|improve this answer
    
k. Interesting, thank you, that does in fact show the Attribute window. However, what is more important to me is displaying or refreshing to that window any/all attributes of this newly created feature at the point of its creation (i.e. FID, OBJECTID, other attribute categories, etc.) –  Josh Oct 13 '10 at 17:24
    
@Josh: you will need to add the new feature to the selection, see my edit. –  Petr Krebs Oct 13 '10 at 17:37
    
Ah right, because a new feature immediately becomes selected (or supposed to anyway). That's it exactly. @petr k., many thanks. –  Josh Oct 13 '10 at 18:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.