ENTER (return) key causing event in Delphi App to fire even though WPF Plugin has focus

We have a WPF .NET Control with a Hydra Visual Plugin being used in a Delphi application. When the ENTER key is pressed the Plugin is not seeing the event and the last control in Delphi to have focus before the WPF control was given focus is a button who’s event fires. I added an OnPreviewKeyDown event handler to the Plugin. The event handler sees all of the key presses except the ENTER (return) key.

Is there something special that is required for the ENTER (return) key to be processed by the Plugin rather than the Delphi application? Have I missed the obvious?

The focus is in a TextBox in the .NET WPF Control.

Thanks in Advance,

Richard

Hi,

I’ve tried to reproduce this problem on a simple host and plugin, but everything looks fine.

What Delphi, Visual Studio and Hydra versions do you use? And how do you transfer focus from host to plugin?

Ejay, thank you for the response. This is happening with the last release of Hydra 3 and the latest Hydra 4. Delphi 2010 and Visual Studio 2008 are the development environments. I am asking the Delphi programmer how focus is being transferred and will get the information posted. I’m on the Plugin/Visual Studio side.

Richard

Here is the relevant Delphi code for loading and displaying the plugin. The plugin is hosted on a TPanel which is on a TPageControl.

type

TMainForm = class(TForm, TestEvents)
HYModuleManager1: THYModuleManager;
PageControl1: TPageControl;
Panel1: TPanel;

const
TestPluginDLL = ‘TestPlugin.dll’;
TestPluginName = ‘TestPlugin.Plugin1’;

procedure TMainForm.StartButton1Click(Sender: TObject);
var
sReturn : string;
begin
if (HYModuleManager1.FindModule(TestPluginDLL) = NIL) then
begin
HYModuleManager1.LoadModule(TestPluginDLL);
HYModuleManager1.CreateVisualPlugin(TestPluginName, fVisualPlugin, Panel1);
(fVisualPlugin as TestPluginVisual).SetEventSink(Self);
end;

btnAbort.Enabled := TRUE;
PageControl1.ActivePageIndex := 1;

sReturn := (fVisualPlugin as TestPluginVisual).TestCall;

end;

Unfortunately still no luck, maybe you have some additional code or component that causes this problem. I’m attaching a small project that can be used for testing, can you please check if it’s working correctly for you? And if it does, can you please modify it (or send us a testcase) so we can reproduce the problem?