Migrating ArcGIS Motif Controls from 9.0 to 9.1


At 9.1 there have been a few changes to the ArcGIS Motif controls and how they are used. While existing applications will still run, if they need to be recompiled the following steps will need to be taken.
  • HRESULT MwCtlGetInterface(Widget w, IUnknown** ppUnk) replaces I<ControlName>Control* Ao<ControlName>ControlGetInterface(Widget w)
[Motif C++]
// 9.0 code
IMapControl3Ptr ipMapControl = AoMapControlGetInterface(mapWidget); 
  // mapWidget is a widget defined earlier

// 9.1 code
IMapControl3Ptr ipMapControl = MwCtlGetInterface(mapWidget, (IUnknown **)
  &g_ipMapControl); // mapWidget is a widget defined earlier
  • aoctl library replaces aomotifctl library

    Makefile at 9.0:    -larcsdk -lmotifctl -laomotifctl

    Makefile at 9.1:    -larcsdk -lmotifctl -laoctl
  • Ao/AoMotifControls.h replaces the individual include for each control (Ao/<ControlName>.h)
[Motif C++]
// at 9.0
#include <Ao/Map.h>
#include <Ao/Toolbar.h>
#include <Ao/TOC.h>

// at 9.1
#include <Ao/AoMotifControls.h>
  • Tool, Command, and Event classes are no longer Motif-specific. esrisystemutility and control-specific tlh's are replaced by including Ao/AoControls.h, and Motif headers can be removed.
[Motif C++]
// at 9.0
// Motif headers
#define String         esriXString
#define Cursor         esriXCursor
#define Object         esriXObject
#define ObjectClass    esriXObjectClass
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/Form.h>
#include <Xm/Protocols.h>
#undef String
#undef Cursor
#undef Object
#undef ObjectClass
// ArcObjects Headers
// Engine
#include <ArcSDK.h>
#include <esrisystemutility.tlh>    // in event classes
#include <mapcontrol.tlh>           // in event classes
#include <mapcontrol_events.tlh>    // in event classes
#include <Ao/AoCommandBase.h>       // in command classes
#include <Ao/AoToolBase.h>          // in tool classes
// Controls
#include <Ao/Map.h>

// at 9.1
// ArcObjects Headers
// Engine
#include <ArcSDK.h>
// Controls
#include <Ao/AoControls.h>          // in event, tool, and command classes
#include <Ao/AoCommandBase.h>       // in command classes
#include <Ao/AoToolBase.h>          // in tool classes