RhinoCommon differences between rhino5 and rhino7 on Rhino.UI.Panels

Hello,

I have a Rhinoceros 5 plugin that handles two panels as System.Windows.Forms.UserControl. These panels are registered with the RhinoCommon method Rhino.UI.Panels.RegisterPanel. I don’t create these usercontrols in my plugin, the instances are created by Rhinoceros at startup.

In Rhinoceros 5 the usercontrols were created only at Rhinoceros startup. When the user opened a different project, the usercontrols linked to the new viewport3D internals.

Now with Rhinoceros 7 the usercontrols are created at each project change (New Project or Open Project). I had a static event that had to be redirected to prevent memory leak.

Is this behavior known or it is a bug on my code? If there is a guideline on the matter, I’d like to know.

Thanks.

Hi @cavalli.stefano,

The panel system is much different in V7, as it takes the Mac’s multi-doc capability into account.

Can you post the code to a sample Rhino 5 plug-in that does not work as you’d expect in Rhino 7?

Thanks,

– Dale

In the attachment a sample VS solution with the same code compiled on Rhinoceros 5.14 32bit and Rhinoceros 7.27 64bit that reproduces the difference:

TestPanelActivation.7z (77.5 KB)

In Rhinoceros 5 the panel is created only at the first project opened.
In Rhinoceros 7 the panel is created at each project change (New Project or Open Project).

Hi @cavalli.stefano,

If you review the help for Panels.RegisterPanel, you’ll notice that there was an override added to Rhino 6 that takes a PanelType parameter. This was added in support of Rhino for Mac, which is a multi-document application. If you call the overide without the PanelType paraemter, a panel type of PanelType.PerDoc is used. This is why your panel’s constructor is being called multiple times.

Hope this helps.

– Dale

Ok, I solved setting PanelType.System

Thanks for the support