Issues with panels

as of version 6.7 we have issues with the newly introduce PanelType. We set all our panel to be PanelType.System so that they have the same behavior as Rhino 5. If we close the panel using the cog icon and open it again this is re-instanced though. Is this expected? My understanding is that once the panel is created is there forever and it is not re-created. Can this be connected to this issue?

Thanks a lot

Hi @Alberto,

Perhaps. We have pushed out a hotfix to SR7 that resolves this. Do you have it installed?

– Dale

This sounds like a different issue Dale

Hi @Alberto,

Looks like this is a different issue than the one reported on the YouTrack item you referenced.

That’s a good question. There is a difference between the panel and the control embedded in the panel. Clearly the control in the panel is created when the panel is displayed and destroyed when the panel is hidden. You can test this by putting break points in control constructor and dispose override.

I am testing with this project:

@JohnM, can you chime in on what the standard behavior shoudl be?

– Dale

I did the following:

  • Built the sample plug-in
  • Started Rhino and loaded the sample plug-in in the debugger.
  • Set break points in the SampleCsPanelUserControl constructor and OnUserControlDisposed methods.
  • Right clicked at the top container docked on the right side or Rhino, the one that contains the layer, object properties and help panels.
  • Clicked on “SampleWinForms” in the pop-up context menu
  • The constructor is called because this is the first time the panel was ever made visible.
  • Right clicked on the panel container again and toggled the panel off.
  • The SampleCsPanelUserControl.OnUserControlDisposed is called.
  • I repeat the process of adding/removing the panel and see it get created and disposed of in the same manner.
    What I discovered is the comment in the panel is incorrect, it turns out that when a panel is removed from a container and not referenced by any other container it is destroyed and disposed of. The panel will get created again and survive as long is it is included in some container. This seems like reasonable behavior, there is no reason to maintain a reference to a panel that does not existing in any Rhino host container. Is there a specific reason this is causing a problem?

I’m trying to get my head around the proper thing to do when this happens, I will mull it over and see if I can come up with the appropriate thing to do in this situation.

I logged this as a bug for @andy and will discuss it with him.

I’ve just looked at this. It isn’t a good idea to rely on the behaviour of a UI element for anything other than UI. The new behaviour is necessary to support the multi-view stuff on the Mac platform, so the only real solution is to re-code your application to not rely on your panel always being there.

Agreed, the documentation need to be updated that the panel will not be created once and never destroyed. I believe that we are not the only ones relying on this behaviour.