Opening Panel with mouse (RMB then LMB on plugin name)

Hey there, it seems to me that opening the panel of my plugin via the panel-tabs bar has changed between Rhino5 and 6. I have a text editor in on my panel and it has information inside it. If i close it and reopen it via the panel-tabs bar in rhino5 it seems to me that it just hides and shows the panel, but in rhino6 it somehow shows another instance of the plugin-panel, which is uninitialized because I don’t handle this scenario apperently.

If I just Open the panel like this at first, then it start the plugin and goes through the init process and works just fine. The problem only appears if I close it like this and reopen it like this.

I have 2 possible scenarios in my mind.

  1. Rhino6 somehow has a cached version of the raw UI and shows that on reopen.
  2. Rhino6 truly closes the whole plug-in(in contrast to rhino5) with this panel-tab bar mouse way, and then it restarts the plug-in on reopen and I just don’t catch that scenario and don’t initialize my plug-in.

Could someone help me with this, what can cause this and how to solve no loose information on reopen?

Thanks,
Kosi

Hey, i’m bumpin the question it would be great if somebody could tell me if, it’s a bug or a feature.

Hi @gabor.konstanzer,

Does this help?

– Dale

Hey, thanks but no. My problem is the created panel should live at least as long as the document. But when I hide it and re-show it with mouse clicks, it gives me a new instance, without firing the Onload or the Initialized event or anything that I know of. And this way I get an empty winForm app without servies initialized. (It works in rhino5 just fine)
I tried to change the panel registration to SystemPanel, but that has nothing to do with this so it didn’t fix the issue.

Hi @gabor.konstanzer,

Can you provide a simple example plug-in that demonstrates the issue? Panels should be registered either in your plug-in’s OnLoad override or in a command constructor. There is no guarantee a panel instance will persist for an entire editing session.

Hi, yes next week I’m gonna try and recreate the issue, with a simple plug-in. If there is no guarantee for the panel, is there any event I can grab, when it is dropped and ensure to at least not loose information?

I included the full solution of a small example. So if i start the plugin by loading it with the command everything is okey, I can handle that and initialize everything. But, if I “hide/close” it with RMB and clicking on the panel name, then I don’t know how to handle that scenario don’t get any information from the form. In rhino5 you didn’t had to do anything it just hid the panel and then reshowed it again with the same instance. Here it recreates it but withouth any notes as far as I can tell.
What should I do to keep the rhino5 feel?

WindowHideTest.zip (161.6 KB)

@gabor.konstanzer

I modified your example to demonstrate two different methods for determining when the panel is shown/hidden or opened/closed. Look in your plug-in’s OnLoad override for the first and in your command for the second.

There were a couple of things that were wrong with the sample:

  1. The panel control was a Form and should be a UserControl
  2. The UI DLL was making an instance of the Form and using it in the run loop.

There is a good Windows Forms panel example on GitHub at this location.WindowHidetestModified.zip (738.0 KB)

Thank you very much for your help!

Hi @JohnM

I have a problem with this type of behavior.
When the control is alone everything works fine and the constructor is only called once. But if the control is next to any other toolbar, every time I hide it and reopen it the constructor is called over and over again.

image
As in the image everything is fine

image
As in the image the constructor is always called