2

I am designing my own Delphi XE5 custom grid. I'm not interested in VCL, so I am working with FireMonkey only. Since it will have to be data-aware, LiveBindings is a must. The task is complex, so I will try to ask just for very specific problems.

A foreword. I am finding FireMonkey (just like the old VCL) a bit difficult to extend. It does use interfaces extensively, but there is still a lot of code that is not overrideable or that references private members. I find myself having to copy entire classes just to change 5-10 lines of behaviour.

What I have now is (ME.Grid):

TCustomGrid -> TMECustomGrid -> TMEGrid (my custom grid)
TColumn -> TMEColumn -> TMExxxColumn (specific custom column classes)
Txxx -> TMExxxCell (specific custom grid cell classes)

All registered with RegisterFmxClasses. TMEGrid is also registered with RegisterComponents.

I also have (ME.Bind.Grid):

TMELinkGridColumnDescription = Class(TLinkGridColumnDescription)
TMELinkGridToDataSourceControlManager = Class(TInterfacedObject,
  ILinkGridToDataSourceControlManager)
TMELinkGridToDataSourceColumnFactory = Class(TLinkGridToDataSourceColumnFactory)

... the latter is registered with RegisterLinkGridToDataSourceColumnFactory

All this with a minimal implementation. I'll add/change behaviour afterwards. My goal now is to drop a TMEGrid on the form, drop some dataset and have the bindings do something with my grid.

What I get (when the application fires up) is EBindCompError 'No list control editor available'.

Since this worked when I had derived TMEGrid from TGrid (which was unacceptable for other reasons), I checked around and I noticed that Bind.Editors references TGrid explicitly (instead of TCustomGrid). So I wrote my own (ME.Bind.Editors):

TMEBindListGridEditor = Class(TBindListEditorCommon,
  IBindListVirtualEditor,
  IBindGridEditor,
  IBindListVirtualEditorScope)
TMEBindGridEditorFactory = Class(TBindEditorFactory)

... the latter is registered with RegisterBindEditorFactory

But this did not seem to change anything. I still get the same error message.

Any ideas?

Keep in mind that all the components, factories, etc... are in their own package (MEComps). The project just has the one form with a grid and some other stuff (a navigator, some buttons).

Edit: I think I have found a clue. I checked my source from within the test project and I found that the

RegisterBindEditorFactory([TMEBindGridEditorFactory]);

code line is not compiled into the project (I can't put a break point there). Obviously it is not being pulled into the project, which is certainly not a good sign. So I checked where the counterpart unit is being used (FMX.Bind.Editors) and I found this very interesting BindCompFMXReg unit, of which I have no equivalent. I'll study this to see if I can get somewhere.

Frazz
  • 2,995
  • 2
  • 19
  • 33

1 Answers1

1

first I'm sorry, I am Brazilian and I can not speak English, so I used Google translate :)- , but would like to help you ...

I had the same problem, I created a grid that constructs the query and columns dynamically, but to activate this grid, the error was generated EBindCompError.

The reason this happens is that LiveBindigs structure needs an editor of the same type that is used in design time.

I looked in the Delphi code and found a simple solution for my case which can also be for your case.

I imported the library Fmx.Bind.Editors and declared a variable of type TBindListGridEditor and just created in the Create method of my Grid, below example:

MyUnit unit;

interface

uses
   Fmx.Bind.Editors ...

type
   TMyGrid = class (TGrid)
   private
    FBindingEditor: TBindListGridEditor;
   public
     constructor Create (AOwner: TComponent); override;
   end;

Implementation

constructor TFBGrid.Create (AOwner: TComponent);
begin
inherited Create (AOwner);
FBindingEditor: = TBindListGridEditor.Create (Self);
end;

end.

I have helped you.

Luiz
  • 113
  • 7
  • Thanks very much. This question is still open for me, even though it has been moved to a lower priority queue ;) I will certainly have a look into your solution and see if it helps. – Frazz Feb 04 '15 at 14:26