We have a .NET plugin descending from RemObjects.Hydra.WPF.VisualPlugin with a plugin wrapper descending from RemObjects.Hydra.WPF.Internal.VisualPluginWrapper as described in http://wiki.remobjects.com/wiki/Passing_interfaces_between_Host_and_Plugins. The plugin is hosted in a Delphi application.
When focus is set to a control within a visual plugin, and the user changes to another application with the mouse or using alt+tab, the focus is not retained when our application is activated again. This seems to be related to the architecture in THYPluginPanel where the control is not notified when focus is returned to the application.
We have temporarily fixed the issue by modifying parts of the THYPluginPanel implementation and by making some extensions in our visual plugin. The approach is to make activation and focusing behaviour similar to the way is is handled in TOleControl.
First, we have designed the plugin send a message to the THYPluginPanel whenever focus is gained and lost by the plugin. When THYPluginPanel receives this message, GetParentForm(self).ActiveOleControl is set to allow the panel to receive notification when the window is activated and deactivated.
Secondly, when window activation/deactivation occurs, the THYPluginPanel requests the visual plugin to save and restore internal focus. This is for now implemented as a custom interface but should ideally be part of the VisualPlugin base class.
Hope to see a fix of this issue soon as it inflicts very much on usability in our application.
Kind regards,
Henrik (Developer at Genus)