Dockable Window - what event can I use

2187
1
09-21-2011 12:28 PM
New Contributor II
I have a tool that opens a Dockable Window using
dockWindow.Show(true);

In my Dockable Window, what event can I use, I need update the contents of the Dockable Window?
Reply
0 Kudos
1 Reply
New Contributor II
Thank You Kevin!

First you need to be able to get access to your Dockable Window class.  To do this follow the instructions at http://geospatialscott.blogspot.com/2010/08/how-to-get-arcgis-add-in-dockable.html.   This basically says you need to add the following property to you DNRInfoToolDockableWindow.AddinImpl class. 
    // this property is what I added - the rest was generated by the template
    internal DNRInfoToolDockableWindow UI
    {
       get { return m_windowUI; }
    }

This will allow you to access your Dockable Window from any add-in using these two lines code.
DNRInfoToolDockableWindow.AddinImpl winImp = AddIn.FromID<DNRInfoToolDockableWindow.AddinImpl>(ThisAddIn.IDs.DNRInfoToolDockableWindow);
DNRInfoToolDockableWindow dnrWindow = winImp.UI;


Now, how to update your Dockable Window.  Create a new method within your dockable window. For example:
        public void updateOnMouseClick()
        {
            MessageBox.Show("Mouse Was Clicked");
        }

Then when the mouse click event fires off�?�
      
using ESRI.ArcGIS.Desktop.AddIns;
...
protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
        {
            //ArcMap.Application.CurrentTool = null;

            UID dockWinID = new UIDClass();
            dockWinID.Value = ThisAddIn.IDs.DNRInfoToolDockableWindow;

            // Use GetDockableWindow directly as we want the client IDockableWindow not the internal class
            IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);

            if(!dockWindow.IsVisible())
                dockWindow.Show(true);
           
            DNRInfoToolDockableWindow.AddinImpl winImp = AddIn.FromID<DNRInfoToolDockableWindow.AddinImpl>(ThisAddIn.IDs.DNRInfoToolDockableWindow);
            DNRInfoToolDockableWindow dnrWindow = winImp.UI;

            dnrWindow.updateOnMouseClick ();

        }
Reply
0 Kudos