Tab key causes NullReferenceException with Hydra WinForms host and Delphi visual plugin

When my Delphi visual plugin has focus within a WinForms HostPanel and I press the tab key, I get the following exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at RemObjects.Hydra.HostPanel.ProcessTabKey(Keys KeyData)
   at RemObjects.Hydra.HostPanel.ProcessDialogKey(Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

Do you know of a reason for this? I can press other special keys, like the arrow keys, and they work. My Delphi visual plugin is a THYVisualPlugin. I’m using the latest version of Hydra (5.0.91.1169).

Hello

Could you send to support@ a testcase where this issue reproduces?

Thanks in advance.

I sent an email with a zip attachment to support@remobjects.com. The archive contains two projects demonstrating the issue I have, a Delphi visual plugin and WinForms host. Please let me know if you got it.

The testcase has been received. I’ll post an answer here once the cause of the issue is found.

Hello

Assigning plugin to the host panel as

(fCurrentPlugin as IHYCrossPlatformVisualPlugin).ShowParented(hostPanel1.Handle);

doesn’t properly initialize internal host panel’s structures so it cannot perform its duties on handling special events like Tab press.

You should assign plugin to the panel as

hostPanel1.HostPlugin(fCurrentPlugin as IBasePlugin);

Also please consider adding OnProcessTabKey event handler to the plugin if you need special plugin handling plugin-side.

Regards

Thank you, that fixed the issue. Sorry for the trouble (it’s my first time with WinForms host and Delphi visual plugins).