HOME - - - - - Delphi Tutorials TOC - - - - - - Other material for programmers
Delicious Bookmark this on Delicious Recommend to StumbleUpon

Delphi tutorial: Using an old project as the basis of a new one (Level 2)

This has good information, and a search button at the bottom of the page

Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc!

Click here if you want to know more about the source and format of these pages.

Using an old project to start a new one.

This may not cover all elements of the process, but it illustrates what I did on one occasion! This guide was reviewed in May 2011, under Delphi 4.

I had DD06 up and working well. I wanted to make a new program which was an adaptation of DD06. I wanted to create a clone from that, under the name DD07, an name I was not yet using, at the time. I proceeded as follows...

I then did File|SaveProjectAs, and when the first box came up, I created and changed to "DD07" folder, changed the default DD06.dpr to DD07.dpr.

It seemed that I might be done, but... Delphi was 'helpfully'(?) remembering that the .pas file for this project was back in DD06's folder... not what I had in mind! I wanted the two projects to be completely independent.

To fix this, I clicked on the DD06u1.pas window, then did File|SaveFileAs, made sure I was still in the DD07 folder and, changed the unit's name from DD06u1.pas to DD07u1.pas. After I had run the project again, I seemed to all the right files, in the right place, and the .exe file was now DD07.exe.

You may want to look at the project's .dpr file to check for problems.

Use View|Units, and open the file equivalent to my DD07. At this stage you would see something equivalent to the following... don't worry about the remaining references to "TDD06f1" and "DD06f1"... yet. We're going to fix them.

program DD07;

uses
  Forms,
  DD07u1 in 'DD07u1.PAS' {DD06f1};

{$R *.RES}

begin
  Application.CreateForm(TDD06f1, DD06f1);
  Application.Run;
end.

Whether you've looked at DD07.dpr or not, there will still be references to DD06f1 in various places.

Use the object inspector to change the name property of the form from DD06f1 to DD07f1. N.B.... Until you have done this, trying to edit the source code to change references to 06 to say 07 is not a good idea. Be sure to press enter, or move out of the "name" edit box after changing the name, or the name change will still only be pending.

At this point, save (can't save too often!) and re-run the program.

Now most references to DD06/DD07 seem to be okay. If you referred to DD06 anywhere in comments that you wrote, I doubt they would be changed... but neither would they prevent the program from running. Now would be a good time to use Delphi's editor's search and replace, with the "confirm changes" option in force, just to see what any references to DD06 remain. Just be careful that if you have something in DD07 saying "Created via a clone from DD06" that you don't change that reference to "06"!

If you opened DD07.dpr earlier, you will find that the references to DD06f1 have "magically" been "fixed". That happened when you changed the name of the project's main form.

Isn't the Delphi working environment wonderful?



   Search this site or the web        powered by FreeFind
 
  Site search Web search
Site Map    What's New    Search    BEWARE: There is stuff at my other two sites that this search won't reveal. Go to either site (see links below) and use that site's FreeFind search button.

In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....

Sheepdog Software homepage.
My Arunet homepage.

Two areas covered within one or another of my sites which you may find interesting...

Not your father's SBC! The Arduino is an inexpensive microprocessor system with much to recommend it to hobbyists, educators... and even people who have "day jobs" where electronics play a part.

Throw off your shackles! We don't need to keep Microsoft in the manner to which it is accustomed! The Open Office open source office suite works just fine. My pages focus on the database element of the suite, but also have some general guidance. Give it a try. Ask your school why they are spending money... and making the parents spend money... on licenses for Microsoft's "Word", Excel, etc.



Click here if you're feeling kind! (Promotes my site via "Top100Borland")


If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service. They offer things for the beginner and the corporation.  www.1and1.com icon

Ad from page's editor: Yes.. I do enjoy compiling these things for you. I hope they are helpful. However... this doesn't pay my bills!!! Sheepdog Software (tm) is supposed to help do that, so if you found this stuff useful, (and you run a Windows or MS-DOS PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to Tutorials main page

Here is how you can contact this page's author, Tom Boyd.



Valid HTML 4.01 Transitional Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org

If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....