Arrow key pan


PurposeThis sample illustrates how the MapControl can be configured to pan around a map using the arrow keys on the keyboard. Most forms or dialogs use the arrow keys to change control focus and do not pass these key values into the OnKeyDown and OnKeyUp events of the MapControl. However, the IMapControl3::KeyIntercept property allows these keys to be trapped before the form or dialog processes them and ensures the OnKeyUp and OnKeyDown events are fired. Note that the OnKeyDown and OnKeyUp events up will only be fired if the MapControl has focus. The sample illustrates this by placing a dashed outline around the MapControl when it has focus.

How to use

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/GulfOfStLawrence/Gulf_of_St._Lawrence.mxd.
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. Click "Load" to load a document. You can edit the document filename on the form.
  2. Set form focus to the map, either by clicking on it or tabbing to it.
  3. Use the arrow keys to pan around the map.

ArrowKeyPan.h Main header file
ArrowKeyPan.cpp Main implementation file
MapControlEvents.h Event header file
MapControlEvents.cpp Event implementation file
Makefile.SolarisMotif Solaris Project Makefile
Makefile.LinuxMotif Linux Project Makefile
Download the Motif_CPP files

Download the files for all languages




Development licensing Deployment licensing
Engine Developer Kit Engine