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 />

XmNtopWidget,<br />

topFormPanel,<br />

XmNleftAttachment, XmATTACH_WIDGET,<br />

XmNleftWidget, leftFormPanel,<br />

XmNbottomAttachment, XmATTACH_FORM,<br />

XmNrightAttachment, XmATTACH_FORM,<br />

MwNprogID, AoPROGID_PageLayoutControl,<br />

NULL);<br />

MwCtlGetInterface(pagewidget, (IUnknown**)&g_ipPageLayoutControl);<br />

d. Manage the new widgets when the others are managed.<br />

XtManageChild(leftFormPanel);<br />

XtManageChild(topFormPanel);<br />

XtManageChild(g_customizeToggle);<br />

XtManageChild(toolbarWidget);<br />

2. Add a new function called CreateCustomizeDialog. This is where you will create<br />

the Customize dialog box.<br />

a. You will place the forward declaration in MapViewer.h.<br />

HRESULT CreateOverviewSymbol();<br />

HRESULT CreateCustomizeDialog();<br />

b. Define it at the bottom of MapViewer.cpp.<br />

HRESULT CreateOverviewSymbol()<br />

{<br />

…<br />

}<br />

HRESULT CreateCustomizeDialog()<br />

{<br />

g_ipCustomizeDialog.CreateInstance(CLSID_CustomizeDialog);<br />

// Set the title<br />

g_ipCustomizeDialog->put_DialogTitle(<br />

CComBSTR(L"Customize Toolbar Items"));<br />

// Don't show the "Add From File" Button<br />

// Adding from file is not an option for your custom C++ Commands.<br />

// The C++ API requires programmatic placement of custom commands<br />

// onto the toolbar control. With the built-in <strong>ArcGIS</strong> <strong>Engine</strong><br />

// Commands already visible in the dialog, nothing needs to be<br />

// added from file.<br />

g_ipCustomizeDialog->put_ShowAddFromFile(VARIANT_FALSE);<br />

// Set the ToolbarControl that the new items will be added to<br />

g_ipCustomizeDialog->SetDoubleClickDestination(g_ipToolbarControl);<br />

return S_OK;<br />

}<br />

Chapter 6 • <strong>Developer</strong> scenarios • 403

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

Saved successfully!

Ooh no, something went wrong!