Dockablewindow dockchanged event

355
1
11-21-2012 07:41 AM
JonDewalt
New Contributor
Does anyone now how to get the dockchanged event to work on a dockablewindow.  I have an Add-in that i would like to programatically set the size of when it becomes undocked but the dockchanged event never seems to trigger.
0 Kudos
1 Reply
DuncanHornby
MVP Notable Contributor
I'm using VB .Net 2010, ArcGIS 10.2.1

I managed to capture if the AddIn dockable window had changed by hooking into the move event of the form.

So went through the AddIN wizard to create a Dockable Window (in my case I called it dkwHotLink), exposed a property called UI so I could gain access to the controls on the form (there are several threads on this forum about that subject), added all the code I needed to for each control on the form and then added the Move event as shown below. If the form is moved it checks if it is floating, if so it resizes it.

    Private Sub dkwHotLink_Move(sender As Object, e As System.EventArgs) Handles Me.Move
        Dim pdockWindowManager As IDockableWindowManager
        pdockWindowManager = DirectCast(My.ArcMap.Application, IDockableWindowManager)


        If Not pdockWindowManager Is Nothing Then
            Dim pUID As UID = New UIDClass
            pUID.Value = "GeoData_Institute_University_HER_AddIn_dkwHotLink"


            Dim pDockableWindow As IDockableWindow
            pDockableWindow = pdockWindowManager.GetDockableWindow(pUID)
            If pDockableWindow.IsVisible Then
                Dim pWindowPosition As IWindowPosition
                pWindowPosition = pDockableWindow
                If pWindowPosition.State = esriWindowState.esriWSFloating Then
                    pWindowPosition.Height = 560
                    pWindowPosition.Width = 349
                    Me.Refresh()
                End If
            End If
        End If
    End Sub


This code seems to fire when you dock/undock the dockable window but not when you are dragging it around.
0 Kudos