Select features in map


Purpose
This sample demonstrates how to select features in a map using the Select tool. This sample uses the Toolbar control and the Map control in conjunction with the Select tool command and a status bar. This sample displays text in the StatusBar control by setting each pane's text property. The HitTest method is used in the IToolbarControlEvents.OnMouseMove event to determine whether the mouse pointer is over an item. If the mouse is over an IToolbarItem, the text of the first StatusBar pane is set to the message of the IToolbarItem.Command.
The IMapControlEvents2.OnMouseMove event sets the text of the second StatusBar pane to the mouse coordinates in map units. TheIMapControlEvent2.OnMapReplaced event is used to keep track of the Map control's map units.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Run the SelectFeaturesInMap application and load a map document.
  2. Click the Select Features command and select a feature. The first StatusBar pane is updated with the mouse pointer's coordinates.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

toolbarbean/SelectFeaturesInMap.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced