1. Home
  2. Computing & Technology
  3. Delphi Programming
Creating your first 'Hello World' Delphi Application
Page 3: Saving your work. Getting help from Delphi.
 More of this Feature
• Page 1: Creating a project
• Page 2: Writing and compiling code

Printer friendly versionPrinter friendly version
 Join the Discussion
"Post your views and comments to this chapter of the free Delphi Programming Course"
Discuss!
 Related Resources
• A Beginner's Guide to Delphi Programming.TOC

   Saving the project
To properly get the job done, you should save the project, along with all its associated files. To save the current form design and its code, select File | Save All from the main menu bar. By default, Delphi opens the Projects folder. I suggest you to create a new folder (inside the Projects folder) for your project. Let's call it "HelloExample". While in the Save As dialog, open the newly created HelloExample folder and save the following files:
. save Unit1 as MainUnit.pas
. save Project1 as HelloProject.dpr

Note 1: When you have saved the unit file, the corresponding form was saved as MainUnit.dfm
Note 2: In the Code Editor window, Unit1 is now referred to as MainUnit.
Note 3: Since you have saved the project with the *new* name, if you run your application now, the button on the Task Bar will say "HelloProject". Of course the name of the application and the name of the project do not need to be the same, later we will see how to change the name of a Delphi application.

HelloWorld Folder

Note, if you open up the HelloExample folder in the Windows Explorer, you should find several files inside it. These are MainUnit.pas, MainUnit.dfm and several others. The most important file inside this folder is the HelloProject.exe. This is your applications executable file, if you double click it you'll execute it. If you want to "install" your application on another machine this is the only file you need to copy.

   Getting HELP from Delphi
Let's stop for the moment to explore ways to get help from Delphi in situations when help is necessary. First of all, Delphi is supplied with extensive documentation. If you do not have the printed manuals, those that came (as PDF) with the installation will do. As stated in the first chapter of this course, the books include:
. Quick Start - a brief introduction to Delphi,
. Object Pascal Language Guide - a complete reference to the underlying Delphi programming language, and
. Developers Guide - which covers advanced topics, from creating database applications to creating your custom components.

Beside printed materials, Delphi holds a great deal of information in the Help system. Even though you'll need to learn how to use it, it is really worth it - there are many code examples to help you understand all the nuts and bolts of Object Pascal programming. What's more, context-sensitive Help is available from nearly every portion of the Code editor. To get context-sensitive Help from the Code editor window simply place the cursor on the property, event, method, procedure or type for which you want Help, then press F1.

Try it. Position the mouse cursor inside the word "Caption" in the Code Editor (the word Caption you typed in the only example so far) and hit the F1 key.

Help system

Once you press the F1 key, a pop up window will ask you to specify more exactly what you want to know. Here comes the hard part: how in the world you know what topic to pick. The "problem" lies in the fact that, in Delphi, many components have properties of the same name (and behavior). To get the help on Form Caption property you need to pick TControl.Caption. Why TControl, when you are working with Form not something called TControl? Well, for the moment this is hard to explain, let's just say that Form derives from something called Control and that Control has a Caption property. What you will find out is that in general, Caption is used for text that appears as a window title.
But how will you know what to pick? There is a solution. Point to Object Inspector, Properties page. Select the property you want to find out about and than press F1.

   Some exercises for you...
Since this Course is an online course, there is much you can do to prepare for the next chapter. At the end of each chapter I'll try to provide several tasks for you to get more familiar with Delphi and the topics we discuss in the current chapter. Here are some exercises for you:

0. Learn about the Name property of the Form object. Note that the Name property should tell you what the form does.
1. Explore the Object Inspector and try to figure what properties relate to the Form positioning on the screen (Left, Top, Width, Height, ...) and what happens when you alter them at design time.
2. Try to change the color of the Form from the Object Inspector (Color property)
3. Learn about the BorderIcons and BorderStyle properties and how they relate to visual representation of the Form at run time.
4. Find what exactly DateTimeToStr is used for.
5. Be sure not to miss the next chapter!

   To the next chapter: A Beginner's Guide to Delphi Programming
This is the end of the third chapter, in the fourth chapter, you'll create a second simple application allowing you to learn hot to place components on a form, set their properties, write evnet handler procedures to make components work together.

If you need any kind of help at this point, please post to the Delphi Programming Forum where all the questions are answered and beginners are treated as experts.

First page > Creating a project > Page 1, 2, 3

A Beginner's Guide to Delphi Programming: Next Chapter >>
>> Chapter 4: Learn about: properties, events and Delphi Pascal

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.