Hello,
I've been trying to add a dockable window to an Addin I'm writing in VB.net but I have the same problem when I use iLogic and I figured it's easier to show an example in iLogic.
My problem is that the contents of the window disappear after a few seconds.
I think I've run into the same problem as: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/addin-dockable-window/m-p/6285785#M6...
But there never was an answer to that specific problem. I used this to make an example in iLogic: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/dockable-window/td-p/9350921
When I run this code, it does add the dockable window. It also show the text, but after a random numbers of seconds the textbox disappears. Running the rule again makes it show, but it will still disappear again.
Dim oUserInterFaceManager As UserInterfaceManager
Dim _DockableWindows As DockableWindows
Dim oDockableWindowsEvents As DockableWindowsEvents
Dim oWindow As DockableWindow
Dim ContentTextBox As System.Windows.Forms.TextBox
Dim InstanceFound As Boolean
oUserInterFaceManager = ThisApplication.UserInterfaceManager
_DockableWindows = oUserInterFaceManager.DockableWindows
ContentTextBox = New System.Windows.Forms.TextBox With {
.ReadOnly = True,
.Multiline = True
}
ContentTextBox.Text="Hi there"
For Each WindowInstance As DockableWindow In _DockableWindows
If WindowInstance.Title = "DockableWindow" Then
WindowInstance.AddChild(ContentTextBox.Handle.ToInt64())
InstanceFound = True
End If
Next
If InstanceFound = False Then
oWindow = oUserInterFaceManager.DockableWindows.Add("SomeOtherSortOfCliendId", "DockableWindowInternalName", "DockableWindow")
oWindow.AddChild(ContentTextBox.Handle.ToInt64())
End If
Solved! Go to Solution.
Solved by laurence.roijackers. Go to Solution.
I think I found an answer, although I still don't understand it.
When I add an Statusstrip it works:
Dim oUserInterFaceManager As UserInterfaceManager
Dim _DockableWindows As DockableWindows
Dim oDockableWindowsEvents As DockableWindowsEvents
Dim oWindow As DockableWindow
Dim StatusStrip As System.Windows.Forms.StatusStrip
Dim InstanceFound As Boolean
oUserInterFaceManager = ThisApplication.UserInterfaceManager
_DockableWindows = oUserInterFaceManager.DockableWindows
StatusStrip = New System.Windows.Forms.StatusStrip
For Each WindowInstance As DockableWindow In _DockableWindows
If WindowInstance.Title = "DockableWindow" Then
WindowInstance.AddChild(StatusStrip.Handle.ToInt64())
InstanceFound = True
End If
Next
If InstanceFound = False Then
oWindow = oUserInterFaceManager.DockableWindows.Add("SomeOtherSortOfCliendId", "DockableWindowInternalName", "DockableWindow")
oWindow.AddChild(StatusStrip.Handle.ToInt64())
End If
Of couse the Ilogic example doesn't make sense anymore, but it also works for the vb.net addin. Where I can add more than just the Statusstrip, although I don't use the StatusStrip.
But why do I need to add the StatusStrip?
Can't find what you're looking for? Ask the community or share your knowledge.