When I create an instance of a Delphi visual plugin (C# host), I am finding that the OnShow event is called, then the OnActivate event, then the OnShow event is called again and then the OnActivate event is called once more…
I’ve tried to get to the bottom of this, I’m not sure but it might be something to do with the “ShowParented” procedure that gets called.
When I start the C# UI, I can see that the plugin is briefly flashing up as if it is a form, then it is later attached to the host panel.
I can’t reproduce this with simple testcase. I’ve modified Mixed Mode\Delphi for Win32\UnmanagedPluginModule sample and added OnActivate and OnShow events. I see that only OnShow fired once.
can you create a simple sample that reproduces this case, pls?
It’s going to be difficult to do this, which is why I haven’t done so yet…
I have the following code:
I create the instance:
fCurrentPlugin = moduleManager1.CreateInstance§; <- form show is called here and if I pause the code I see it physically appear on top of the main screen
Then I host it
PluginControl.HostPlugin(fCurrentPlugin as IBasePlugin); <- form show also called here and I see it in the HostPanel
// release previsuly loaded plugin
fCurrentPlugin = null;
pnl_Host.UnhostPlugin();
fCurrentPlugin = moduleManager1.CreateInstance(lb_Plugins.SelectedItem as PluginDescriptor);
pnl_Host.HostPlugin(fCurrentPlugin as IBasePlugin);
if (fCurrentPlugin is IHYCrossPlatformNonVisualPlugin)
(fCurrentPlugin as IHYCrossPlatformNonVisualPlugin).Start();