I have a C# host and a Delphi visual plugin. The visual plugin has a popup menu where the popup shortcuts DO work. However, other Delphi forms can be launched from this plugin and it seems these forms are not working in the same way, so none of the keyboard shortcuts for the form’s popup menu work.
When this was a standalone program this all worked correctly.
What versions of Hydra and Delphi do you use? Also can you please create a small testcase that reproduces this problem? You can send it to support@remobjects.com, thanks.
I use XE5 and am one version behind with Hydra (March 2014).
All you have to do to reproduce it is to put a popup menu on the example “Unmanaged plugin module” in the mixed mode example, with a shortcut and you will see that shortcut does not work.
I guess i understand what is the problem, you are trying to press shortcut key in the .NET form, not in the plugin. There are two things:
HostPanel handles only its own message, not application wide. So, if you need to run execute shortcut in a plugin you need to do this manually.
While checking this, i’ve found that there is a problem with processing shortcuts in case there is no active control on a Delphi side, logged this for further review.
Thank you, I’ve downloaded it and tried it. It partially works. It works on the main “form”, but if you launch another form from within the plugin, it does not work on that form. Do you have any ideas why that might be?
@robhoney72: Looks like this is the same problem as with plugins, Delphi handles shortcuts in different places and most of them is triggered by Application which is not available in the plugin.
Please try to modify your form like this:
uses
uHYPluginHelpers, uHYCrossPlatformInterfaces;
type
TYourRegularForm = class(TForm)
[...]
private
Helper: IHYCrossPlatformVisualPluginEx;
public
function WantChildKey(Child: TControl; var Message: TMessage): Boolean; override;
end;
procedure TYourRegularForm.FormCreate(Sender: TObject);
begin
Helper := THYControlAsVisualPlugin.Create(self);
end;
function TYourRegularForm.WantChildKey(Child: TControl; var Message: TMessage): Boolean;
begin
result := Helper.HandleShortCuts(Message.WParam);
end;
This will trigger same mechanism that Hydra uses to process shortcuts in a plugins.
Yeah, this is because WantChildKey receives multiple message, we can filter them to take only key down, like this:
function TYourRegularForm.WantChildKey(Child: TControl; var Message: TMessage): Boolean;
begin
if Message.Msg = WM_KEYDOWN then
result := Helper.HandleShortCuts(Message.WParam)
else
result := false;
end;
I have just downloaded and installed the latest release (May 2016) and now the shortcuts no longer work again. Before the upgrade, they were working fine. Why might this be?
While putting the example together for you, I saw that everything seemed to be working again, so perhaps it was something else. I’ll monitor it, but there may not be a problem, sorry.