Saving a project

This section explains how to save an open project to the directory created to store it (that is, the project directory).

Note If the project was begun from a Project Template, the Gallery selection process creates the project directory. Otherwise, Delphi saves projects by default to the \BIN directory, unless you specify otherwise.

  • To save all open project files to the project directory, use one of the following methods:
  • Choose FilelSave Project.
  • Choose the Save Project button on the Delphi SpeedBar.
  • Choose the Save Project command on the Project Manager SpeedMenu.

From here, the save process for projects varies somewhat depending upon whether or not the project has been saved.

First project save

If you have not previously saved the project, Delphi displays the Save As dialog box. This dialog box prompts you to supply a name for each open unit file that has been created in the current project. (You are not prompted for any shared files you might have added to the project. See "Sharing files from other projects or directories" earlier in this chapter.)

After you name the unit file(s), Delphi prompts you to name the project source code (.DPR) file before saving it to disk. This processing order ensures that the unit and form file names you just specified are correctly registered in the project file's source code.

Subsequent saves

If you have previously saved the project, all open files that reside in the project directory are saved to disk if they have been modified.

If you have opened any new forms or units in the project since the last save, the Save Unit As dialog box appears and prompts you to name those unit files before saving them.

The .DPR project file is then updated to reflect any new units and any newly shared files that you might have specified for the project to use.

Naming unit and project source code files

As you open new units in a project, Delphi supplies them with default names such as UNIT1.PAS, UNIT2.PAS, UNIT3.PAS, and so on. You will soon run into confusion if you use these default names when saving the project. It is highly advisable to supply a meaningful name for each unit in a project as you save it.

When naming the project source code file, you need to supply a name not previously used by any of the unit files listed in the uses clause of the .DPR file. If you attempt to give the project the same name as one of these units, Delphi displays an error message similar to the following:

If this occurs, respond OK to the error message box and supply a different name for the .DPR file in the Save As dialog box.

As with unit files, Delphi supplies a default name, PROJECT1.DPR, for the unit source code (.DPR) file. Again, you should supply a more meaningful name when saving the file for the first time.

All unit and project file names must conform to DOS naming conventions.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment