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.

C++ APPLICATION PROGRAMMING INTERFACE<br />

• mwCtlWidgetClass—argument to give the widget class for all ActiveX control<br />

widgets<br />

• MwNprogID—argument to pair with AoPROGID_Control<br />

Control widget creation example<br />

The following example demonstrates creating a map control that fills the entire<br />

Motif mainForm (defined outside this code snippet) and retrieves a smart pointer<br />

for the control. The bold sections highlight functions and resources discussed<br />

above. The #define statements are necessary to prevent type name conflicts between<br />

X and <strong>ArcGIS</strong> <strong>Engine</strong>.<br />

// Motif Headers<br />

#define String esriXString<br />

#define Cursor esriXCursor<br />

#define Object esriXObject<br />

#define ObjectClass esriXObjectClass<br />

#include <br />

#include <br />

#include <br />

#include <br />

#undef String<br />

#undef Cursor<br />

#undef Object<br />

#undef ObjectClass<br />

// ArcObjects Headers<br />

// <strong>Engine</strong><br />

#include <br />

// Controls<br />

#include <br />

int main(int argc, char* argv[])<br />

{<br />

...<br />

Widget mapWidget = XtVaCreateWidget("mapWidget",<br />

mwCtlWidgetClass, mainForm,<br />

XmNtopAttachment, XmATTACH_FORM,<br />

XmNbottomAttachment, XmATTACH_FORM,<br />

XmNleftAttachment, XmATTACH_FORM,<br />

XmNrightAttachment, XmATTACH_FORM,<br />

MwNprogID, AoPROGID_MapControl,<br />

NULL);<br />

IMapControl3Ptr ipMapControl;<br />

HRESULT hr = MwCtlGetInterface(mapWidget, (IUnknown**)&ipMapControl);<br />

...<br />

}<br />

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