Help with new project using dockable window

Help with new project using dockable window

DSantos23
Enthusiast Enthusiast
556 Views
5 Replies
Message 1 of 6

Help with new project using dockable window

DSantos23
Enthusiast
Enthusiast

Hello everyone,

 

I'm just getting started with my 1st add-in, for Inventor 2022, and I'm struggling to understand what's going on with the line of code below:

 

DSantos23_0-1651299187658.png

I started this project based on the project sample shared by @liminma8458, here:

 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/how-to-make-dockable-window-align-be...

 

I renamed some stuff and used @BrianEkins's Nifty add-in template as my starting point... When I compare @liminma8458 code against mine, they are almost identical, yet in his sample, the problem does not happen...

 

Can anyone take a look at my VS2019 solution (attached) and point me in the right direction, please?

 

Thanks in advance,

Daniel

0 Likes
Accepted solutions (1)
557 Views
5 Replies
Replies (5)
Message 2 of 6

Ralf_Krieg
Advisor
Advisor

Hello

 

Can't test your code, but I think the example has a override sub .Show within the form_dockable class that accepts arguments. The standard .Show method did not accept arguments. Try it without any arguments

dc = New UCSWizard_Main_Frm(ThisApplication)
dc.Show() 

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 6

DSantos23
Enthusiast
Enthusiast

Hi Krieg,

 

Thanks for the prompt reply... 

 

I tried that and the form does not appear... Only the tab is created... 

0 Likes
Message 4 of 6

Ralf_Krieg
Advisor
Advisor

Hello

 

Could take a look at your project now. The dockable window exists as long as your command is active. I think this is because you create the instance within the sampleButton_OnExecute Sub. After this sub ends, your form is disposed automatically.

There are two possible ways. If you tell which one is yours, we can add basic code to get it.

1. If you want the window only be active as long as the command is active.

Let your command start an Interaction and loop until the user press the "Exit" button in your window. Take this button press to stop the interaction. After your command stops, the dockable window will disappear

2.If you want the window to be activated by your button and should stay visible until Inventor is closed.

Create the instance of the dockable window  in your StandardAddinServer.vb Activate Sub and make it visible instantly.

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 5 of 6

DSantos23
Enthusiast
Enthusiast

Hi Krieg,

 

Thanks again... 

 

The behavior I want the command to have is this:

 

  • User clicks on the command icon in the ribbon to launch the form. 
  • User clicks on the "X" in the window frame to close the window, when it is docked or simply floating on the screen. 
  • If the user wants to see it again he clicks on the command icon in the ribbon.

 

Pretty much how the inspect command works... 

 

I hope I answered your question... Thanks again for your help! 

0 Likes
Message 6 of 6

DSantos23
Enthusiast
Enthusiast
Accepted solution

So just a quick heads up here... Foor those who may bump into this issue in the future as I did...

 

The cause for the problem is that in the original project @liminma8458 shared here:

 

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/how-to-make-dockable-window-align-be...

 

He used a Form (the class inherits from System.Windows.Forms.Form)

 

When I ported that code to a new project based on the Nifty template from Brian, I created the form as Control (the class inherits from System.Windows.Forms.UserControl) because of some other posts I read here.

 

So deleting the User Control and recreating it as a Form without borders solved the weird error.

 

HTH

Daniel

0 Likes