18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BUILDING APPLICATIONS WITH C++ AND CONTROL WIDGETS<br />

g_ipTransEventHelper = 0;<br />

delete g_transEvents;<br />

g_ipMapControlEvent2Helper->UnadviseEvents();<br />

g_ipMapControlEvent2Helper->Shutdown();<br />

g_ipMapControlEvent2Helper = 0;<br />

delete g_mapEvents;<br />

16. Update the makefile to reflect the MapControlEvents source file. Also, add a<br />

dependencies list for MapControlEvents.o and add the MapControlEvents class<br />

to the MapViewer.o dependencies list.<br />

17. Compile and run the application. Use the map navigation tools that you<br />

added earlier to change the extent of the focus map in the<br />

PageLayoutControl. The new extent is drawn on the MapControl as a red<br />

rectangle.<br />

Creating a custom tool<br />

You are not limited to placing the <strong>ArcGIS</strong> <strong>Engine</strong> commands and tools on the<br />

ToolbarControl. Next, you will create a custom tool that adds to the<br />

PageLayoutControl a text element containing today’s date at the location of a<br />

mouse click. However, this tool will be created as a generic tool so that it could<br />

instead work with the MapControl and ToolbarControl as well as the<br />

PageLayoutControl.<br />

The code for this custom tool is available with the rest of this scenario’s source<br />

code. If you want to use the custom command directly, rather than creating it<br />

yourself, copy the AddDate.h and AddDate.cpp files, along with the Res folder<br />

from the MapViewer folder, to the directory you are using for this scenario and<br />

proceed to Step 5.<br />

392 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!