I created a custom TClientDataset that I then registered as a design time component.
TMyDataset = class(TClientDataset)
public
constructor Create(AOwner : TComponent); override;
end;
in the Create method, I created the fields of this dataset
implementation
constructor TMyDataset.Create(aOwner : TComponent);
var
lField : TStringField;
begin
inherited Create(aOwner);
lField := TStringField.Create(Self);
lField.FieldName := 'NAME';
lField.Dataset := Self;
Fields.Add(lField);
end;
When registering the component as such
procedure Register;
begin
RegisterComponents('Queries', [TMyDataset]);
end;
And dropping the TMyDataset onto a form, I do not see the NAME field in the Fields collection of this dataset.
My goal is to define and register these predefined queries so I can use them at design time.
I would like to prevent anyone using this component from redefining the Fields of this dataset, but still be able to see them in the visual editor to bind cxGrid or such (automatic column creation and so on).
Also, this Dataset is only a placeholder for another dataset. It will only serve to present the Fields collection to other visual editors that can bind to them.
My question is :
Why can't I see the field I created in the constructor in the visual editor and how can I make it visible?
How can I override the behavior of the component to never save the user modifications on its TFields into the DFM ?
Thank you