This document is archived and information here might be outdated.  Recommended version.


GeoDatabaseUI (ArcObjects .NET 10.8 SDK)

GeoDatabaseUI


Supported with:
  • ArcGIS for Desktop Basic
  • ArcGIS for Desktop Standard
  • ArcGIS for Desktop Advanced
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

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 GeodatabaseUI library provides user interfaces (UIs) including property pages to support objects in the Geodatabase library. The library supports a number of dialog boxes that you can use; TableView, Calculator, and the version dialog boxes are all defined in this library.
It is not common for developers to extend this library.

See the following sections for more information about this namespace:

TableView

In ArcMap, all tables are presented in a table data window. Table windows contain a table view, also known as a table control. In ArcCatalog, there are no table windows; rather, a table view is directly displayed as a GX view. The TableView object is cocreatable. For example, you can instantiate a new TableView object, link it to a table, and display it in a custom form.
The primary interface on the table view objects is ITableView. Use this interface to link a table to the table view and display it. ITableView2 manages some additional table view properties such as whether the table can be edited. It also controls whether the table only shows selected records or all records.
The ITableControl, ITableControl2, and ITableControl3 interfaces manage methods that apply to an existing displayed table. Use methods on these interfaces to draw the features currently selected in the table, redraw the table after edits have been made, and set the current row in the table. The ITableControlWidth interface has two properties that aid in sizing the table when it's first displayed. The RecommendMinimumTableWidth property returns the minimum width the table needs to be to see all columns. The FullTableWidth property returns the current table width. The ITableViewTableFields interface has one property that provides access to the fields in the table.

Calculator and CalculatorUI

The Calculator and CalculatorUI objects are used to update field values in a table.
Calculator
The Calculator object is the underlying object used to calculate field values in a table. Use the ICalculator interface to update field values in a table, which can be either a stand-alone table or the attribute table of a feature class. Use the ICalculatorCallback interface to get warnings, errors, and status during the calculation process.
The following code example shows how to use the Calculator object:
[C#]
public void Calculate(ITable table)
{
    // Get the selected table.
    IDataset dataset=(IDataset)table;

    // Start editing with undo/redo.
    IWorkspace workspace=dataset.Workspace;
    IWorkspaceEdit workspaceEdit=(IWorkspaceEdit)workspace;
    workspaceEdit.StartEditing(true);
    workspaceEdit.StartEditOperation();

    // Open a cursor on the table.
    IQueryFilter queryFilter=new QueryFilterClass();
    string whereClause=table.OIDFieldName + " < 20";
    queryFilter.WhereClause=whereClause;
    ICursor cursor=table.Search(queryFilter, false);

    // Check for a rowset on which to work.
    if (table.RowCount(queryFilter) > 0)
    {
        ICalculator calculator=new CalculatorClass();
        ICalculatorCallback calculatorCallback=new CalculatorCallbackClass();

        // Simple calculation.
        calculator.Cursor=cursor;
        calculator.Callback=calculatorCallback;

        // Triple quotes for text string updates.
        calculator.Expression="AA";
        calculator.Field="STATE_FIPS";

        // Display a msgbox if an error occurs.
        calculator.ShowErrorPrompt=true;
        calculator.Calculate();

        // Stop editing and save edits.
        workspaceEdit.StopEditOperation();
        workspaceEdit.StopEditing(true);
    }
    else
    {
        // Stop editing, but don't save edits. 
        workspaceEdit.StopEditOperation();
        workspaceEdit.StopEditing(false);
    }
}
[VB.NET]
Public Sub Calculate(ByVal table As ITable)
    
    ' Get the selected table.
    Dim dataset As IDataset=CType(table, IDataset)
    
    ' Start editing with undo/redo.
    Dim workspace As IWorkspace=dataset.Workspace
    Dim workspaceEdit As IWorkspaceEdit=CType(workspace, IWorkspaceEdit)
    workspaceEdit.StartEditing(True)
    workspaceEdit.StartEditOperation()
    
    ' Open a cursor on the table.
    Dim queryFilter As IQueryFilter=New QueryFilterClass()
    Dim whereClause As String=table.OIDFieldName & " < 20"
    queryFilter.WhereClause=whereClause
    Dim cursor As ICursor=table.Search(queryFilter, False)
    
    ' Check for a rowset on which to work.
    If table.RowCount(queryFilter) > 0 Then
        Dim calculator As ICalculator=New CalculatorClass()
        Dim calculatorCallback As ICalculatorCallback=New CalculatorCallbackClass()
        
        ' Simple calculation.
        calculator.Cursor=cursor
        calculator.Callback=calculatorCallback
        
        ' Triple quotes for text string updates.
        calculator.Expression="AA"
        calculator.Field="STATE_FIPS"
        
        ' Display a msgbox if an error occurs.
        calculator.ShowErrorPrompt=True
        calculator.Calculate()
        
        ' Stop editing and save edits.
        workspaceEdit.StopEditOperation()
        workspaceEdit.StopEditing(True)
        
    Else
        ' Stop editing, but don't save edits.
        workspaceEdit.StopEditOperation()
        workspaceEdit.StopEditing(False)
    End If
    
End Sub
CalculatorUI
The CalculatorUI object exposes a dialog box that allows you to visually use the Calculator object to calculate field values. Use ICalculatorUI2 to set up the UI, then call ICalculatorUI.DoModal to show the dialog box.

Versioning

There are two objects that are used to expose the version subsystem in the UI: the NewVersionDialog and VersionManager objects.
NewVersionDialog
The INewVersionDialog interface on the NewVersionDialog object can be used to prompt the user for the information necessary when creating a version.
The following code example shows how to use the NewVersionDialog object:
[C#]
public IVersion CreateNewVersion(IVersion version)
{
    INewVersionDialog newVersionDialog=new NewVersionDialogClass();
    IVersion newVersion=null;

    if (newVersionDialog.DoModal())
    {
        string newName=newVersionDialog.VersionName;
        newVersion=version.CreateVersion(newName);
        newVersion.Access=newVersionDialog.VersionAccess;
        newVersion.Description=newVersionDialog.VersionDescription;
    }
    return newVersion;
}
[VB.NET]
Public Function CreateNewVersion(ByVal Version As IVersion) As IVersion
    
    Dim newVersionDialog As INewVersionDialog=New NewVersionDialogClass()
    Dim newVersion As IVersion=Nothing
    
    If newVersionDialog.DoModal() Then
        Dim newName As String=newVersionDialog.VersionName
        newVersion=Version.CreateVersion(newName)
        newVersion.Access=newVersionDialog.VersionAccess
        newVersion.Description=newVersionDialog.VersionDescription
    End If
    
    Return newVersion
    
End Function
VersionManager
The VersionManager object is used to expose the version in a versioned workspace. The IVersionManager interface on the VersionManager object can be used to show the Version Manager dialog box. The IVersionManagerEvents interface can be used to sink to the events raised when versions are created, deleted, and renamed within VersionManager.
The following code example shows how to use the VersionManager object:
[C#]
class EventList
{
    public IVersionManagerEvents_OnVersionCreatedEventHandler dOnVersionCreatedE;
    public void SetupVersionManagerEvents(IVersionManager versionManager)
    {
        IVersionManagerEvents_Event versionManagerEvent=
            (IVersionManagerEvents_Event)versionManager;

        //Wire OnReconcile event.
        dOnVersionCreatedE=new IVersionManagerEvents_OnVersionCreatedEventHandler
            (versionManagerEvents_OnVersionCreated);
        versionManagerEvent.OnVersionCreated += dOnVersionCreatedE;
    }

    //Event handler method.
    private void versionManagerEvents_OnVersionCreated(IVersion version)
    {
        string versionName=version.VersionName;
        MessageBox.Show("Created " + versionName);
    }
}
[VB.NET]
Private Class EventList
    
    Public dOnVersionCreatedE As IVersionManagerEvents_OnVersionCreatedEventHandler

    Public Sub SetupVersionManagerEvents(ByVal versionManager As IVersionManager)
        Dim versionManagerEvent As IVersionManagerEvents_Event=CType(versionManager, IVersionManagerEvents_Event)
        
        'Wire OnReconcile event.
        dOnVersionCreatedE=New IVersionManagerEvents_OnVersionCreatedEventHandler(AddressOf versionManagerEvents_OnVersionCreated)
        AddHandler versionManagerEvent.OnVersionCreated, dOnVersionCreatedE
    End Sub
    
    'Event handler method.

    Private Sub versionManagerEvents_OnVersionCreated(ByVal Version As IVersion)
        Dim versionName As String=Version.VersionName
        MessageBox.Show("Created " & versionName)
    End Sub
    
End Class