Editing Data


This sample demonstrates using the Edit, Editor, File and PanZoom Control's Command samples in conjunction with the Microsoft Windows Common ToolBar Control and ImageList Control. For the sample to run the following COM components must be registered on the system and referenced in Visual Basic:

ESRI Sample Edit Commands (Edit.dll)

ESRI Sample Editor Commands (Editor.dll)

ESRI Sample File Commands (File.dll)

ESRI Sample PanZoom Commands (PanZoom.dll)

Microsoft Windows Common Controls (Mscomctl.ocx)

When each ICommand is created it is passed the MapControl as a hook, so it knows what object it must work with and the Command is added to a Command's Collection with the Command's Name property as its key. The Command's Bitmap is added to the ImageList Control and a new Button is added to the ToolBar Control, both with key values set to the Command's Name property. The Button's image is accessed from the ImageList Control, and its Enabled, TooltipText and Description properties are set to those of the Command's Enabled, Tooltip and Message properties.

When a user clicks a button on the ToolBar, its ButtonClick event is fired. The Command item is returned from the Commands Collection using the Button's key value and its OnClick event is triggered. If the Command is a type of ITool it is set to the MapControl's CurrentTool.

The appearance of the ToolBarControl and the MapControl's CurrentTool is updated whenever the ToolBar's ButtonClick event or the MapControl's OnAfterDrawScreen event is triggered. The Enabled property of each Button in the ToolBar Control is set to that of its associated Command in the Commands Collection. If the MapControl's CurrentTool has become disabled the CurrentTool is set to Nothing.

How to use:
  1. Ensure that the COM components are registered on the system.
  2. Either run the EditData.exe or open the EditData.vbp and run from within the project.


Minimum ArcGIS Version Required: 8.2

Difficulty: Intermediate

Visual Basic
File Description
EditData.frm VB form file for the EditData project.
EditData.frx VB Binary file.
EditData.bas VB Module file.
EditData.vbp VB Project file.

Key CoClasses: MapControl
Key Interfaces: ICommand, ITool
Key Members: CurrentTool