18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING APPLICATIONS WITH THE ARCGIS CONTROLS<br />

For step-by-step scenarios walking you through<br />

the <strong>ArcGIS</strong> controls development process, refer to<br />

the ‘Building applications’ scenario of your choice<br />

in Chapter 6, ‘<strong>Developer</strong> scenarios’.<br />

The <strong>ArcGIS</strong> controls can be used to build applications in two ways: the <strong>ArcGIS</strong><br />

controls can be embedded into an existing application to add additional mapping<br />

capability, or the <strong>ArcGIS</strong> controls can be used to create a new standalone application.<br />

In either case, an individual <strong>ArcGIS</strong> control can be embedded into an application<br />

or the TOCControl and ToolbarControl can be used in conjunction with<br />

another <strong>ArcGIS</strong> control to provide part of the application’s framework. The<br />

following sections discuss the application development process for the controls<br />

both when you are utilizing the ToolbarControl and when you choose not to.<br />

APPLICATION DEVELOPMENT USING THE TOOLBARCONTROL<br />

The ToolbarControl is typically used in conjunction with a buddy control and a<br />

selection of the control commands to quickly provide a functional GIS application.<br />

The ToolbarControl is not only providing a part of the user interface; it is also<br />

providing a part of the application’s framework. <strong>ArcGIS</strong> Desktop applications,<br />

such as ArcMap, ArcGlobe, and ArcScene, have a powerful and flexible framework<br />

that includes user interface components such as toolbars, commands,<br />

menus, dockable windows, and status bars. This framework enables the end user<br />

to customize the application by allowing them to reposition, add, and remove<br />

most of these user interface components.<br />

Many development environments provide some pieces of a framework in the<br />

form of simple dialog boxes, forms, and multiple docking interface (MDI) applications.<br />

They also provide generic user interface components such as buttons,<br />

status bars, and list boxes. However, a substantial amount of coding can still be<br />

required to provide toolbars and menus that host commands, especially if they<br />

need to be customized by the end user.<br />

The ToolbarControl and the objects within its library can supply pieces of a framework<br />

similar to the <strong>ArcGIS</strong> Desktop application framework. You can use some or<br />

all of these framework pieces when building an application with the<br />

ToolbarControl.<br />

Commands<br />

<strong>ArcGIS</strong> <strong>Engine</strong> provides several suites of control commands that work with the<br />

<strong>ArcGIS</strong> controls to perform some specific action. You can extend this suite of<br />

control commands by creating their own customized commands that perform<br />

some specific piece of work. All of these command objects implement the<br />

ICommand interface that is used by the ToolbarControl to call methods and access<br />

properties at appropriate times.<br />

The ICommand::OnCreate method is called shortly after the Command object is<br />

hosted on the ToolbarControl. The method is passed a handle or “hook” to the<br />

application with which the command will work. The implementation of a command<br />

normally tests to see if the hook object is supported (that is, the command<br />

tests to see that the hook is an object that the command can work with). If the<br />

hook is not supported, the command disables itself. If the hook is supported, the<br />

command stores the hook for later use. For example, if an Open Map Document<br />

command is to work with the MapControl or PageLayoutControl, and they are passed<br />

to the OnCreate method as the hook, the command will store the hook for later<br />

use. If the ToolbarControl is passed to the OnCreate event as the hook, the command<br />

would normally check the type of buddy control being used in conjunction<br />

50 • <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!