| Creating your first 'Hello World' Delphi Application | |||||||||||||||||||
| Page 2: Writing code, compiling and running your application for the first time. | |||||||||||||||||||
Hello Delphi To add the code that changes the caption of the form we need to *call* the Code Editor window. If you have the Project Manager displayed on the screen, double click the Form1. This will bring up the Form designer window to the front. Another way to bring the Form1 to the front of the screen is to select Form1 from the Window menu. Once Form1 is on top and active, double click it. This action has the following result: the Code editor is positioned on the top of the screen and Delphi creates the skeleton code for the new event handler.
As stated in the second chapter of this course, each form has a collection of events – such as a mouse click, keypress, or component activation – for which you can specify some additional behavior. In this case the event is called OnCreate. This event occurs when the form is created.
For the moment do not get bothered with the meaning of the text you see.
Now alter the code so that it looks like:
Running a project for the first time ![]() Note: if you want to see progress reports while your program compiles, you'll need to check the "Show compiler progress" check box in the "Compiling and running" section on the Preferences page of the Environment Options dialog box. Call this dialog box by selecting Environment Options from the Tools menu. ![]() If everything goes well (it should) your application is executed and you see a blank form on the screen. Note several things. First, the form is blank - there are no dots that make up the grid you see when designing the form look. Second, there is a new button on the Windows Task Bar - when you point to it you'll see that it has the Project1 caption. Third, the caption of Delphi IDE is changed from "Delphi 6 - Project 1" to "Delphi 6 - Project 1 [Running]". And fourth, most important for us, the caption of the form is Hello Delphi ! + *date and time of the execution*. There is not much you can do with this window, you can move it resize it and finally close it. Every time you (compile and) run this project a form caption will say Hello Delphi with the date and time of the execution. Ok, I know this is not a lot, but be patient - this is your first project - it is not supposed to do something meaningful. If you want a little more, here goes another simpe example. Next page > Saving your work, geting help > Page 1, 2, 3 A Beginner's Guide to Delphi Programming: Next Chapter >> |
|||||||||||||||||||


