Select to view content in your preferred language

Using the Attribute Window as a Dialog

633
2
03-16-2012 04:49 AM
MartinMayer1
Deactivated User
Hello,

I would like to use the Attribute Editor as a Dialog like it is used if you check the Checkbox at "Editor - Editing Options - Attributes" or at least control this Checkbox programmatically.

[ATTACH=CONFIG]12756[/ATTACH]

After several days searching Google and the API Reference i was wondering if someone of you has an Idea.


The Idea behind is using a list of EditTemplates with default Values where only a few Attributes have to be edited by the User.
Most will be filled by the EditTemplate but the User has to explicit press the OK Button to indicate he checked the other Attributes.

Some EditTemplates may fill all Attributes, so the User doesn't need to edit any attribute and the Editor shouldn't show.
The Field visibility is controlled by a xml and will be set before opening the dialog.

Thanks in advance.
0 Kudos
2 Replies
DonFerguson
Occasional Contributor
Did you ever get an answer for this?  I have the same question!!

thanks,
Don Ferguson
0 Kudos
JeffreyHolden
Occasional Contributor
// This Method runs any ArcGIS Command
// Parameters sCommandUID       esriEditor.AttributionCommand
// iCommandSubType                  3
// All the commands are listed here
// http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/ArcMap_commands/0001000...


using ESRI.ArcGIS.Framework;
using ESRI.ArcGIS.esriSystem;

        public static bool RunCommand(string sCommandUID, int iCommandSubType)
        {
            ///<summary> Run an exisitng ArcGIS Command</summary>
            ///<param name="sCommandUID"> sCommandUID Command Name see examples below</param>
            ///<param name="iCommandSubType"> iCommandSubType SubType of the Command see examples below</param>  
            ///<returns>Returns: bool true if the command was found.
            ///                       false if the command was not found.</returns>
            ///              
            ///<remarks>This will run any specific ArcGIS Command that it finds.  If it does not run the command it may not be on the toolbar.
            /// Command         sCommandUID                     iCommandSubType
            /// SaveEdits       esriEditor.SaveEditsCommand          3
            /// Attribution     esriEditor.AttributionCommand        3
            /// Zoom Selected  esriMapUI.ZoomToSelectedCommand      0
            /// Clear Selection esriMapUI.ClearSelection             0
            /// Pan             esriMapUI.PanTool                    0
            /// Select Features esriMapUI.SelectFeaturesTool         0
            /// Open Table      esriMapUI.OpenTable                  0
            /// </remarks>
            // Method:   Method Name
            // Author:   Jeffrey Holden
            // Date:     November 20, 2012
            ESRI.ArcGIS.esriSystem.UID pUID = new ESRI.ArcGIS.esriSystem.UIDClass();
            pUID.Value = sCommandUID;
            pUID.SubType = iCommandSubType;
            IApplication pApplication = Internal.AddInStartupObject.GetHook<IMxApplication>() as IApplication;    // Get the application object.
            ICommandItem pCommandItem = pApplication.Document.CommandBars.Find(pUID);

            // Check that the Command Item was found
            if (pCommandItem == null) // if the command item was not found display a message and return false.
            {
                // Display a message on the screen
                string sCommandNotFoundMessage = "The command " + sCommandUID + " of the type " + iCommandSubType.ToString() + " was not found in the active toolbars" + "\n Add the tool to or activate the toolbar";
                string sCommandNotFoundCaption = "Command not found";
                var result = MessageBox.Show(sCommandNotFoundCaption, sCommandNotFoundMessage, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            else
            {
                pCommandItem.Execute();
                return true;
            }
        }


///  Jeffrey Holden
///  jeffrey.holden@dnr.wa.gov
0 Kudos