I'd like to write a complex component that embeds other components. But I am not sure if I'll be able to connect to those components via object inspector.
To clarify, imagine a component that holds a list of TDataSources. These DataSource components are owned by this component and not visible on the form.
Now I'd like to connect a TDataset to one of these Datasources, is that possible, will these Datasources show up in the property editor combo of Dataset ?
It is possible, but you have to type (or copy) the name; you cannot select it in the OI.
Using the component written below, you can type e.g. MyComp1.InternalDataSource into the DataSource property of a DBGrid:
uses
Classes, DB;
type
TMyComp = Class(TComponent)
private
FDataSource: TDataSource;
public
constructor Create(AOwner: TComponent);override;
published
property DataSource: TDataSource read FDataSource;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('TEST', [TMyComp]);
end;
{ TMyComp }
constructor TMyComp.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FDataSource := TDataSource.Create(Self);
FDataSource.Name := 'InternalDataSource';
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With