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. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  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.


Download the files for Java
toolbarbean/SelectFeaturesInMap.java Main class




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo