ArcMapUI


Supported with:
  • ArcView
  • ArcEditor
  • ArcInfo
Library dependencies: Version, System, SystemUI, Geometry, GraphicsCore, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, EngineCore, TrackingAnalyst, Framework, Desktop.Addins, GeoDatabaseUI, DisplayUI, OutputUI, Search, Catalog, CatalogUI, CartoUI, DataSourcesRasterUI, ArcCatalog, ArcCatalogUI, ArcMap

Additional library information: Contents, Object Model Diagram

To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
The ArcMapUI library provides user interface (UI) components specific to the ArcMap application. The components contained in this library cannot be used outside the context of ArcMap. The IMxApplication and IMxDocument interfaces are defined in this library, although they are implemented in the ArcMap library. The ArcMap table of contents is implemented in this library, along with many of the commands present in ArcMap.
 
Developers extend this library by creating custom commands and tools for use in the ArcMap application.
 
A few of the ArcMap GPS Support toolbar objects are located in the ArcMapUI library. The most important is GpsExtension. Access GpsExtension through the IGpsExtension interface. The GpsPositionDialog coclass provides access to the GPS position dialog from the toolbar. GpsLogFilter allows you to filter the incoming points from the Global Positioning System (GPS) device. Other GPS support objects reside in the Carto library.

See the following sections for more information about this namespace:

FindFeatures and FindWindowUI

FindFeatures is used to create custom Find dialogs. Implement IFinder to create a custom find dialog page.
The FindWindowUI object is a window used to display the Find dialog. Use the IFindPanelEvents interface to access events that control communication between find pages and the main find form.

QueryAttributes

The QueryAttributes object displays the query attribute dialog in an ArcMap document. The IQueryAttributes interface provides access to members that control the attribute query window.
Use IQueryAttributes to manage the attribute query dialog. First, set the Application property with a reference to the application. Then set the other properties—the selection CombinationMethod, the Layer on which the selection will be performed, and, optionally, the default query expression in Expression. SelectFeaturesInLayerOnOK specifies whether or not the selection will be performed when you click Apply in the dialog and whether or not error messages will be shown. Setting it to true is useful if you want to use this dialog to gather input and process it on your own.
Open the dialog with the DoModal method. If you need to open the dialog as modeless, you can cast IQueryAttributes into IModelessQueryAttributes, and use its Show method.
On return, the QueryFilter property contains the expression used for the selection. CombinationMethod and Layer are also updated with your choices.
[VB.NET]
'Set this to false to launch a modal dialog using IModelessQueryAttributes.
Private Const DIALOG_IS_MODAL As Boolean = True
Dim m_ModelessQueryAttributes As IModelessQueryAttributes

Public Sub SampleQueryAttributes(ByVal application As IApplication)
    
    Dim document As IDocument = application.Document
    Dim mxDocument As IMxDocument = CType(document, IMxDocument) ' Explicit cast.
    
    'Create a new Query Attribute dialog and set the necessary properties before launching it.
    Dim queryAttributes As IQueryAttributes = New QueryAttributesClass
    queryAttributes.Application = application
    
    'Layer to select from is the first to appear in the TOC.
    queryAttributes.Layer = mxDocument.FocusMap.Layer(0)
    
    'Provide a default expression if desired.
    'Note: this is Access geodatabase syntax.
    queryAttributes.Expression = "[ADMIN_NAME] = 'Ontario'"
    
    'Choose the selection method.
    queryAttributes.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew
    
    If DIALOG_IS_MODAL Then
        'Launch the dialog as modal.
        queryAttributes.DoModal(application.hWnd)
    Else
        'Or launch the dialog as modeless.
        m_ModelessQueryAttributes = CType(queryAttributes, IModelessQueryAttributes)
        m_ModelessQueryAttributes.Show(application.hWnd)
    End If
    
    'Find the changes made by the user.
    MessageBox.Show("Selected layer is " & queryAttributes.Layer.Name)
    
    If queryAttributes.CombinationMethod <> esriSelectionResultEnum.esriSelectionResultNew Then
        MessageBox.Show("Selection method has changed")
    End If
    
    MessageBox.Show("Query expression is " & queryAttributes.QueryFilter.WhereClause)
    
End Sub
[C#]
//Set this to false to launch a modal dialog using IModelessQueryAttributes.
private const bool DIALOG_IS_MODAL = true;
private IModelessQueryAttributes m_ModelessQueryAttributes;

public void SampleQueryAttributes(IApplication application)
{
    IDocument document = application.Document;
    IMxDocument mxDocument = (IMxDocument)document; // Explicit cast.

    //Create a new Query Attribute dialog and set the necessary properties before launching it.
    IQueryAttributes queryAttributes = new QueryAttributesClass();
    queryAttributes.Application = application;

    //Layer to select from is the first to appear in the TOC.
    queryAttributes.Layer = mxDocument.FocusMap.get_Layer(0);

    //Provide a default expression if desired.
    //Note: this is Access geodatabase syntax.
    queryAttributes.Expression = "[ADMIN_NAME] = 'Ontario'";

    //Choose the selection method.
    queryAttributes.CombinationMethod =
        esriSelectionResultEnum.esriSelectionResultNew;

    if (DIALOG_IS_MODAL)
    {
        //Launch the dialog as modal.
        queryAttributes.DoModal(application.hWnd);
    }
    else
    {
        //Or launch the dialog as modeless.
        m_ModelessQueryAttributes = (IModelessQueryAttributes)queryAttributes;
        m_ModelessQueryAttributes.Show(application.hWnd);
    }

    //Find the changes made by the user.
    MessageBox.Show("Selected layer is " + queryAttributes.Layer.Name);

    if (queryAttributes.CombinationMethod !=
        esriSelectionResultEnum.esriSelectionResultNew)
    {
        MessageBox.Show("Selection method has changed");
    }

    MessageBox.Show("Query expression is " + queryAttributes.QueryFilter.WhereClause)
        ;
}