Search code examples
delphidelphi-xe2

Add Component to tool palette in Data Module


I was wondering if there is a way to add tools to a data module's tool palette.

On a standard form under 'data access' tools I have a number of 'TXML' tools, however these aren't under 'data access' tools on a data module.

Can I add these or not?

Thanks,


Solution

  • I don't know if you can add them to the tool palette, but you can use them if you create the objects yourself like in the example below.

    unit Unit2;
    
    interface
    
    uses
      System.SysUtils, System.Classes,Xml.xmldom, Xml.XMLIntf,
      Xml.XMLDoc;
    
    type
      TDataModule2 = class(TDataModule)
      private
        { Private declarations }
      public
        { Public declarations }
        procedure test;
      end;
    
    var
      DataModule2: TDataModule2;
    
    implementation
    
    {%CLASSGROUP 'Vcl.Controls.TControl'}
    
    {$R *.dfm}
    
    { TDataModule2 }
    
    procedure TDataModule2.test;
    var
      xml :TXMLDocument;
    begin
    try
       xml :=  TXMLDocument.Create();
    finally 
       xml.Free;
    end;
    end;
    
    end.
    

    I've added to use the units for the XMLDocument, then i've created the object myself.