Terry Thompson
Terry Thompson

Reputation: 533

Adding a datamodule to the delphi object repository

I am using D10 Pro. I added a datamodule to the object repository by right clicking it and selecting "Add to Repository" on the popup menu.

The datamodule shows up in the New>Other dialog and I am able to click the icon for it. When I do, I get the following exception: "Unable to find both a form () and source file (). The same exception occurs with forms I place there. The object that came with Delphi load without any problem. How do I fix this?

Upvotes: 0

Views: 925

Answers (2)

Terry Thompson
Terry Thompson

Reputation: 533

When adding items to the repository, you should avoid using dotnet style names for your files. For example, I originally named the file "MyLib.Datamodule.TextImporter.pas" and I received the error in my question. I experienced the same problem with a form using the same dotnet style naming. After changing the file name to "TextImporterDatamodule.pas" and adding it to the repository, I was able to use it to create new datamodules without a problem. This is something Embarcadero needs to address.

Upvotes: 2

MartynA
MartynA

Reputation: 30715

I can't answer your q, but maybe this will help you track down your problem.

Contrary to what the DocWiki says for Seattle, the repository .Xml file is actually named "Repository.Xml" and in my case is located here:

C:\Users\MA\AppData\Roaming\Embarcadero\BDS\17.0\Repository.Xml

I added a data module to it, resulting in the entry shown below being added. Notice that for a datamodule, the path to it is stored in its IDString attribute along with the filename, unlike a form, where the path+name is stored in the the Value attribute of the FormName node.

With that entry in place, unlike you I can then include a copy of it in a project by going to File | New | Other in the IDE. However, if I then change the on-disk name of the folder where the item is located, and try to use it, I get the error message you quoted. Of course, that doesn't mean that's why you're getting it, but I thought it might help to see the repository entry for something that's known to work.

<Item IDString="D:\Delphi\Code\SO\Devex\DM1" CreatorIDString="BorlandDelphiRepositoryCreator">
     <Name Value="AAADataModule"/>
      <Icon Value=""/>
      <Description Value="MA datamodule"/>
      <Author Value="MA"/>
      <Personality Value="Delphi.Personality"/>
      <Platforms Value=""/>
      <Frameworks Value=""/>
      <Identities Value="RADSTUDIO"/>
      <Categories>
        <Category Value="InternalRepositoryCategory.MyCategory" Parent="Borland.Delphi.NewFiles">MyCategory</Category>
        <Category Value="Borland.Delphi.NewFiles" Parent="Borland.Delphi.New">Delphi Files</Category>
        <Category Value="Borland.Delphi.New" Parent="Borland.Root">Delphi Projects</Category>
      </Categories>
      <Type Value="FormTemplate"/>
      <Ancestor Value=""/>
      <FormName Value=""/>
      <Designer Value="Any"/>
</Item>

If this doesn't help, best I can suggest is to post your q in the IDE section of EMBA's newsgroups here:

https://forums.embarcadero.com/forum.jspa?forumID=62

I don't think that should provoke cross-posting complaints, seeing as your q has been up here for a while without getting a definitive answer.

Upvotes: 0

Related Questions