Supported with:
- ArcView
- ArcEditor
- ArcInfo
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, Geodatabase, GISClient, ArcWeb, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location, GeoAnalyst, Animation, Maplex, Geoprocessing, NetworkAnalyst, Schematic, SpatialAnalyst, 3DAnalyst, GlobeCore, Publisher, TrackingAnalyst, FrameworkAdditional library information: Contents,
Object Model Diagram
The GeodatabaseUI library provides user interfaces (UIs) including property pages to support objects in the Geodatabase library. The library supports a number of dialogs that developers can use; TableView, Calculator, and the version dialogs are all defined in the library.
It is not common for developers to extend this library.
The objects that implement this functionality are grouped into a number of library subsystems. These library subsystems are: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; instead, 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
Calculator
The Calculator object is the underlying object used to calculate field values in a table. The
ICalculator interface should be used when you want to update field values in a table, which may 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(ESRI.ArcGIS.Geodatabase.ITable table)
{
// Get the selected table.
ESRI.ArcGIS.Geodatabase.IDataset dataset = (ESRI.ArcGIS.Geodatabase.IDataset)table;
// Start editing with undo/redo.
ESRI.ArcGIS.Geodatabase.IWorkspaceEdit workspaceEdit = dataset.Workspace;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
// Open a cursor on the table.
ESRI.ArcGIS.Geodatabase.IQueryFilter queryFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
queryFilter.WhereClause = table.OIDFieldName + " < 20";
ESRI.ArcGIS.Geodatabase.ICursor cursor = table.Search(queryFilter, false);
// Check for a rowset on which to work.
if (table.RowCount(queryFilter) > 0)
{
ICalculator calculator = new Calculator();
ICalculatorCallback callBack = new ClassName();
// Simple calculation.
calculator.Cursor = cursor;
calculator.Callback = callBack;
// 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);
}
}
CalculatorUI
The CalculatorUI object exposes a dialog that allows you to visually make use of the Calculator object to calculate field values. Use
ICalculatorUI2 to set up the UI, then call
ICalculatorUI.DoModal to show the dialog.
Versioning
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 ESRI.ArcGIS.Geodatabase.IVersion CreateNewVersion(ESRI.ArcGIS.Geodatabase.IVersion version)
{
INewVersionDialog newVersionDialog = new NewVersionDialogClass();
ESRI.ArcGIS.Geodatabase.IVersion newVersion;
if(newVersionDialog.DoModal())
{
newVersion = version.CreateVersion(newVersionDialog.VersionName);
newVersion.Access = newVersionDialog.VersionAccess;
newVersion.Description = newVersionDialog.VersionDescription;
}
return newVersion;
}
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. 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(versionManagerEvent_OnVersionCreated);
versionManagerEvent.OnVersionCreated += dOnVersionCreatedE;
}
//Event handler method.
private void versionManagerEvents_OnVersionCreated(ESRI.ArcGIS.Geodatabase.IVersion version)
{
System.Windows.Forms.MessageBox.Show("Created " + version.VersionName);
}
}