Hydra 4 Visual Plugin VS DataGridView

Hi,
I have an issue, with an older version of Hydra, I am hopeful you might still be able to help.

I have a Delphi application with a Visual Plugin hosted in VS2019 .Net 4.52 containing a DataGridView. The gridview is embedded in a UserControl which is placed into the Visual Plugin. When activating the plugin in the Delphi application, all components display correctly, but the data grid does not display any data from the object data source it is bound to.
When using the UserControl from a Winforms application in VS2019, the grid displays all data correctly. I also verified that the data source contains a number of records when activate from the Delphi side.

Any help would be appreciated.

TIA
Bernhard

Hello

Try to explicitly call Refresh() on your data grid once the plugin is displayed. When used as a plugin WinForms might not notice that the component is already displayed and should be refreshed.

Hi Anton,
Thanks for the follow-up, but unfortunately, that didn’t help.

Just to ensure I am doing it right, here is what additional code I added. Would you expect a different behavior if I upgraded to the latest version of Hydra?

  1. Delphi
      Calendar_Plugin.ShowParented(pn_RegEUILib);
      PlgCalendar.Refresh();
    
  2. VS - Plugin
     public partial class TPlgCalendar : VisualPlugin, IPlg_Calendar
     public new void Refresh()
     {
       ucHolidays1.Refresh();
     }
    
  3. VS - User control
    public partial class ucHolidays : Finser.UILib.ucBase
    public new void Refresh()
    {
    dataGridView1.Refresh();
    }

Perhaps it would be better if you create a simple (ie no external dependencies) testcase that reproduces your issue.

That would greatly help to pinpoint what is going wrong.

I will do that and provide it here…

Hi Anton,

I discovered the basic source of my issue. If I embed a plain user control derived from the VS Usercontrol into the plugin, the data in the grid displays as expected.
However, if I derive the UserControl from a BaseUserControl I created with DevExpress layout controls in them, the data does not display.
So it is clearly some kind of initialization issue or sequence issue in how the controls are initialized.
Any thoughts…

DevEx controls are very complex and (most probably) were not expected/designed to work as part of a User Control hosted in a Win32 form.

To start with, add a button to your plugin and add a code that will trigger data refresh in the data grid. Try to press this button once the plugin is loaded. This will help to determine if this is a initialization sequence issue or the control just cannot work in this environment at all.

Hi Anton,

After a lot of troubleshooting, I determined that the DevExpress LayoutControl was the culprit in stopping the data from being displayed. They also have a DataLayoutControl which ended up working as expected.
The difference, as pointed out by DevExpress Support, was a property on the LayoutControl UseLocalBindingContext. It defaulted to False on the LayoutControl and true on the DataLayoutControl.

Setting the property makes the Plugin and embedded User control display the data in a DataGrid or DevExpress GridView as expected.

This is an important step in my strategy of moving a large Delphi application that is currently in production step by step into Visual Studio using the Hydra technology. We have already used the Non-Visual plugin to transition most of our business logic, this will enable us to complete the process a step at a time while maintaining an active, revenue producing application.

Thanks for your help

Bernhard

1 Like