Wrapper of TFMXGrid


I need to have a wrapper around the TFMXGrid.

Every component that I use in my project due the framework we created need some special behaviors to exchange data.

Up to know that was simple task.

I now trying to validate the use of TFMXGrid in our project

And went the same way of the other components:

Simple example:

TMyGrid = class(TTMSFMXGrid, <my interfaces>);
end;

Then I install it, since it is part of a package, and when I drop this component on the form it does not show any of the grid properties. And the grid is itself is empty.

What is needed to create a simple wrapper and do not change anything on the published properties of the Grid?  

I need to add only one published property, that will expand to many options of my framework.

Thanks

Eduardo


TMyGrid is a new class that will search for a TMyGrid style, which does not exist. To solve this you will need to overide the GetClassStyleName.


type
  TMyGrid= class(TTMSFMXGrid)
  protected
    function GetClassStyleName: String; override;
  end;

implementation

function TMyGrid.GetClassStyleName: String;
begin
  Result := ClassParent.ClassName + 'style';
  Delete(Result, 1, 1);
end;


Pieter Scheldeman2014-09-29 02:43:01

Pieter, 


I made this wrapper and it worked.

However I am having a problem with it, I have removed anything that is from my code for testing and after installing the TMyGrid I get a Stack Overflow.

I have some components that are just wrapper adding interfaces to adapt them to my framework.

I have removed them all, and left only the one with TTMSFMXGrid wrapped.

Unitsalling, installing back again, clean, build all, etc. I believe I made everything to make it registered without this message.

AFter the stack overflow, the form show up fine and I can select my grid wrapped and put in the form. But I need always to first open a empty form to get this error and then I can work with any other form. If I try to open a form with the wrapper first it does not recognize the component at all.

Is the Grid requiring something else for its initialization? some unit? 
Hi, 

It is unclear what exactly is missing.
This is also the first time we have such issue reported with custom component development.
Could perhaps copy the unit, rename the grid and reinstall the package to see if you can drop for example a TMyGrid2 on the form without the stack overflow?

As an second option for testing, can you create the grid at runtime from a button click or formcreate?
If you get the stack overflow message, where does the issue occur?

Kind Regards, 
Pieter