Adding existing forms and units to a project

 

A project can share any existing form and unit file including those that reside outside the project directory tree. This includes custom Object Pascal procedures and functions that have been written as standalone routines.

If you add a shared file to a project, realize that the file is not copied to the current project directory; it remains in its current location. Adding the shared file to the current project registers the file name and path in the uses clause of the project's dpr file. The product automatically does this as you add units to the project.

Note:          The path that the product uses for the shared file is either absolute or relative, depending on where the file is located. If the shared file is located on the same disk drive as your project, the product uses a relative path for the file; otherwise, it uses an absolute path.

When you compile your project, it does not matter whether the files that make up the project reside in the project directory, a subdirectory of the project directory, or any other location. The compiler treats shared files the same as those created by the project itself.

To add a shared file to the current project, do one of the following:

·Choose Project|Add to Project.

·Choose the Add File to Project button on the toolbar.

·Choose Add from the Project Manager context menu.

Any of these actions displays the Add To Project dialog box, in which you can select the file you want the current project to use. The Path column of the Project Manager's file list displays the path to the shared file.

 

Using Borland Pascal source code units

If you have existing source code units for custom procedures or functions written in Borland Pascal or Turbo Pascal, you can use these units in a Delphi project. You add these files in the same way as files created in Delphi.