How to get TDataSource to use Delphi CDS

(Berlin)

I have a TClientDataSet defined on a datamodule ("cdsLog").

I have the following defines/registrations in the DMs onCreate:

  
 IDEScripter1.AddComponent(cdsLog);
 IDEScripter1.DefineClassByRTTI(TSQLConnection, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TDBXOdbcDriverLoader, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TCustomSQLDataSet, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TSQLDataSet, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TDataSetProvider, roInclude, true);
IDEScripter1.DefineClassByRTTI(TDataSet, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TClientDataSet, roInclude, true);
 IDEScripter1.DefineClassByRTTI(TDataSource, roInclude, true);

 With IDEEngine1 do
  begin
    BeginRegisterComponents;
    try
      RegisterComponent('DBX',     TSQLConnection, 'DB');
      RegisterComponent('DBX',     TSQLDataSet, 'DB');
      RegisterComponent('DBX',     TDataSetProvider, 'DB');
      RegisterComponent('DBX',     TDataSource, 'DB');
      RegisterComponent('DBX',     TClientDataSet, 'DB, DBClient');
    finally
      EndRegisterComponents;
    end;
  end;




With the above, I can create a new form, and (in code) access cdsLog (eg cdsLog.Open).

If I drop a TDataSource on the form, I cannot select cdsLog as the dataset.

I'd like to be able to give users the ability to design their own forms around ClientDataSets that I have pre-built and populated in my application.

I can't figure out how to get the TDataSource to "see" the datasets in my DataModule.

Have I missed something in the registrations/setup?

Cheers,
EdB

You can't. The scripter IDE form designer can only see components that are in the script form, not Delphi form/data modules.

Ah.

Oh well, not the end of the world to get around:
 - generate data in delphi, save to xml.
 - in script form, drop a cds,  set cds.filename to xml file and set active.
 - design form with data

At run time do something like this in script:


procedure ShowLogForm;
var
 uLogForm:TfLogFOrm;
begin
  uLogForm:=TfLogForm.Create(nil); 
  try
     uLogForm.ClientDataSet1.FileName  := '';   // make sure not to load from file        
     uLogForm.DataSource1.DataSet      := cdsLog; // set to non-form cds
     uLogForm.ShowModal;
  finally
    uLogForm.Free;
  end;
end;



I'm always amazed at how well stuff works in scripter.

Then something doesn't work the way I want it to, which leads me to be amazed at how easy these things (generally) are to get around.

It really is a cool product - I'm still getting through learning curve, and having fun. Thanks!