1

When this tool is active, and a user clicks within the main map window it's getting an IPoint using an IRubberPoint. I would like to use that point to update information on a dockable window.

Example for simplicity: For the point returned from the Tool, I would like to display the X and Y coordinates on a dockable window.

How do I call a (non-static) dockable window function from the 'OnMouseDown' method on Tool?

The Tool:

public class tlPoint : Tool
{
    public tlPoint ()
    {
    }

    protected override void OnMouseDown(MouseEventArgs arg)
    {
        base.OnMouseDown(arg);

        IActiveView pActiveView = ArcMap.Document.ActiveView;
        IScreenDisplay3 screenDisplay = activeView.ScreenDisplay as IScreenDisplay3;
        IRubberBand rubberBand = new RubberPoint();
        IPoint point;

        point = rubberBand.TrackNew((IScreenDisplay)screenDisplay, null) as IPoint;

        // TODO: Call function on dockable window
    }

    protected override void OnUpdate()
    {

    }
}
  • Did you try IDockableWindowDef.UserData to get a reference to whatever UI control is defined in the dockable window? edndoc.esri.com/arcobjects/9.2/ComponentHelp/esriFramework/… – Kirk Kuykendall Mar 6 '17 at 19:20
  • I have not, I will look into it now and see if it does what I need. – John Grabanski Mar 6 '17 at 19:25
  • Assuming I understand the link. I don't believe this will be useful without very creative code\event handling. I'm not just trying to update labels/Textboxes in my actual solution, I'm just using it as example for simplicity. I'm actually using the Point retrieved from the tool to run a spatial query on a mosaic dataset in order to find the raster who's counterpoint is closest to the Point, and displaying it on a AxMapContol on the Dockable window. I can add this to the question, but wasn't sure if it was relevant and didn't want to over complicate it. – John Grabanski Mar 6 '17 at 19:35
  • Note that's a very old link. Since then add-ins now support Dockable windows. The strategy for those is a bit different. – Kirk Kuykendall Mar 6 '17 at 19:36
  • 2
    See geonet.esri.com/thread/56498 – Kirk Kuykendall Mar 6 '17 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.