Opening panel calls constructor every time

Hello,

This happens at Rhino 8:

Thank you

Hi @Eliseo,

Yes, if you have a “per-doc” panel then this is true.

What problem are you trying to solve?

Thanks,

– Dale

Hi @dale ,

First of all, what is the meaning of “per-doc”?

My problem is that a multitude of data is created in the panel, including connections to databases and datasets that cannot be constantly destroyed and created.
The control data must remain as it was before the panel was hidden.

Thanks,
Eliseo

Hi again @dale,

Is there any other way of not to call the destructor and constructor when the form is hidden/shown?
Anyway, the panel is registered as Panel.System like this

Rhino.UI.Panels.RegisterPanel( this, typeof( Interface ), VisibleName( ), Interface.GetControlIcon( 128, 32 ), PanelType.System);

Thanks

That’s my experience as well. In R7 panels are loaded once and unloaded on `RhinoApp.Closing’, but R8 unloads panels each time they become invisible. Hence when docked, activating another panel, unloads your active one.

I’m not a huge fan of this behavior either.

1 Like

Hi @Eliseo,

When registering your panel, specify PanelType.System.

– Dale

Hi @dale,

in R8, switching between panels using side tabs triggers the OnUnLoad / OnLoad events even when PanelType.System is used. R7 doesn’t behave this way.

Hi @dale

As I told you before, this is the the way I register the panel:
Rhino.UI.Panels.RegisterPanel( this, typeof( Interface ), VisibleName( ), Interface.GetControlIcon( 128, 32 ), PanelType.System);

Any other suggestion?