1

Continuing with our Delphi 2010 thick client to multi-tier migration (previous question), we are at the point where we need to find a databinding solution. I have come across RemObjects Hydra. The thing is I can't seem to follow their tutorials for the host program and for the plugin I have created a Hydra plugin project in visual studio, implemented the interface as described and that builds fine.

[Guid("8F1B3EE3-CC69-4685-B141-FAF2F4FB57C4")]
public interface IGridPlugin : IHYCrossPlatformInterface
{
    string UserData { get; set; }
    int ID { get; set; }

}

In the plugin:

[Plugin(Name = "GridPlugin", Description = "This is the Grid plugin", UserData = "Data"), VisualPlugin]
public partial class GridPlugin : RemObjects.Hydra.WPF.VisualPlugin, IGridPlugin
{

In Delphi I have created a new Hydra host project, imported the interface, but in the form create/load events they mention:

procedure TMainForm.FormCreate(Sender: TObject);
begin
  ModuleManager.LoadModule('SilverlightPlugin.xap');
  ModuleManager.CreateVisualPlugin('SilverlightPlugin', fInstance, Panel1);
end;

What is fInstance? Also, no files in my WPF plugins project end in .xap, so what am I supposed to pass as a parameter?

Has anyone implemented RemObjects Hydra, how did you achieve this early step? Any help will be appreciated.

Community
  • 1
  • 1
reckface
  • 5,678
  • 4
  • 36
  • 62
  • Hydra should contain sample projects which show how to use it. Also for the Delphi Host you might refer to this article as you have a WPF plugin and not a silverlight one: http://wiki.remobjects.com/wiki/VCL_Host – Stefan Glienke Oct 05 '12 at 21:26
  • Thanks. I got it working in the end. The example didn't declare fInstance, but one of the other videos ([LINK]http://www.remobjects.com/tv/hydra.aspx?video=hydra-02-firemonkey) explained (after writing the method call to CreateVisualPlugin) the need to declare it, and more crucially what it is - fInstance: IHYVisualPlugin; – reckface Oct 09 '12 at 12:49

1 Answers1

1

This is how I got it working in the end, you need to declare an instance of the plugin:

Private
  fInstance: IHYVisualPlugin;

// Then Call in the FormCreate event
procedure TMainForm.FormCreate(Sender: TObject);
begin
    ModuleManager.LoadModules('C:\Users\user.Name\Documents\Visual Studio 2010\Projects\DynamicEF4\Product.Delphi.WPF\BIN\RELEASE\Product.Delphi.WPF.dll');
   ModuleManager.CreateVisualPlugin('ViewerPlugin', fInstance, pnl1);
end;
// And then in the FormDestroy event
procedure TMainForm.FormDestroy(Sender: TObject);
begin
    ModuleManager.ReleaseInstance(fInstance);
end;

I guess I was looking at the wrong example, the .xap I saw related to silverlight, and not required for wpf or windows forms.

reckface
  • 5,678
  • 4
  • 36
  • 62