Map tips


Purpose
This sample demonstrates displaying map tips in the MapControl by setting the ToolTipText property to the value of ILayer::TipText in the OnMouseMove event.

How to use

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 on "AddLayer" and browse to a feature layer to add it to the map (you may repeat this step).
  2. Select a layer from the layer combobox.
  3. Select a field from the field combobox.
  4. Activate the MapTipTool by selecting it's icon on the toolbar.
  5. Move the mouse over a feature and the text from the field you selected will be displayed in a textfield underneath the MapControl.

Additional information

The browse dialog allows users to search and select map documents, which are loaded into the MapControl using the LoadMxFile method. The Name of each layer within the MapControl is added to a ComboBox at the same index. When a layers Name is selected in the ComboBox the ILayerFields and IField interfaces are used to loop through the layers fields. The Name of each field is added to a second ComboBox. If the field Name is the same as the IFeatureLayer::DisplayField it is selected in the ComboBox. The DisplayField is the field from which ILayer::TipText is obtained and can be changed by selecting a different field Name from the ComboBox.
 
A CheckBox indicates whether map tips will be displayed for the selected layer using the ILayer::ShowTips property. If ILayer::ShowTips is true, the MapControl's ToolTipText property is set to the ILayer::TipText value within the OnMouseMove event. The OnMouseDown event of the MapControl uses the TrackRectangle method to zoom in if the left mouse button is used, and the Pan method if the right mouse button is used.


MapTip.h Header file
MapTip.cpp Implementation file
MapTipTool.h Header file
MapTipTool.cpp Implementation file
MotifUtilities.h Header file
MotifUtilities.cpp Implementation file
SharedInclude.h Header 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 Runtime