Object, huh, Inspector?
How to Start Turbo Delphi?
Welcome to the second part of the free online Delphi programming tutorial: Programming in Delphi For Novices and Non-Programmers!
This series of tutorials is oriented to those who want to take their chance in the world of software development, it is designed to teach the complete beginner (read: "non-programmer") how to become a programmer using Delphi.
In the first lesson, you have downloaded and installed your free version of Delphi: Turbo Delphi Explorer (for Win32 development).
This time, we are going to take a tour of the Delphi IDE - Integrated Development Environment.
The IDE comprises several tools and menus and, in general, helps you visually design user interfaces, set object properties, write code, and view and manage your application in various ways.
Note: By default, Turbo Delphi is installed in the "\Program Files\Borland\BDS\4.0\Bin" folder. "BDS" stands for "Borland Developer Studio" and "4.0" is the version. In short: BDS 4.0 = Borland Developer Studio 2006.
To start Delphi select the "Turbo Delphi" option from the Start - All Programs - Borland Developer Studio 2006 menu.
When Delphi starts (it could even take one full minute to start - depending on your hardware performance) you are presented with the IDE...
What are all those parts of the Turbo Delphi IDE?
The default IDE desktop layout includes some of the most commonly used tools. You can use the View menu to display or hide certain tools. You can also customize and save the desktop layouts that work best for you. Here are the parts, areas of the IDE, as outlined by the screen shot:
For example: take a look at section marked with 2. This largest part of the IDE is where you will be writing programming code("Code Editor"), designing your application windows /forms ("Form Designer"), open existing projects, read programming blogs, etc. ("Welcome page").
Delphi IDE is "work sensitive" - it will display different sections depending on your current work.
The toolbar provides a number of shortcuts to most frequently used operations and commands - such as running a project, or adding a new form to a project. To find out what particular button does, point your mouse "over" the button and wait for the tooltip. As you can see from the tooltip, for example, point to "Open Project", many toolbuttons have keyboard shortcuts ("Ctrl+F11").
While you have no projects opened in the IDE, the main part of the screen goes to the "Welcome page"...
What should I do on the Turbo Delphi "Welcome Page"?
The Welcome page gets displayed in the center of the Turbo Delphi IDE. You can use it to create new project, open an existing project, launch Delphi help, and similar.
Welcome Page acts as a web browser, you can actually enter a web address in the address bar and surf to your favorite Delphi web site :)
I want to see some Delphi program in Action!
The easiest way to start learning about the other parts of the IDE is to open an existing Delphi demo project and take a scary look at the IDE - how it transforms to the development beast ;)
What I would like to show you is one Delphi application that comes as a demo project.
This way the IDE will have enough to display - for you to get a better understanding of what happens with the IDE as you "activate" different parts of the program.
Here's how to open and run your first Delphi program (ok, I know, it's not yours)
This is a Windows application written in Delphi - and it even does something very smart!
WARNING: IDE has just gone berserk, it turned into what programmers call "debug mode" - help the IDE return to normal state by closing the "Convert It" application - just hit the little [x] button.
Why don't you believe? Delphi is that easy: Open, F9 ... and here we have an executable ;)
What's a "Structure" section used for?
Let's now see what else the Delphi IDE is consisted of.
Before I go into detailing other sections of the IDE, select the second tab near the "Welcome page" - the one named "ConvertItUnit".
No, don't bother with what do you see below the tab. Let's concentrate on the other parts of the IDE.
A Windows program created with Borland Delphi will at least have one window - let's call this a form.
A form will contain several controls or components, you know : buttons, tabs, drop down selectors, status bar, etc.
Some controls will be child controls to other, for example a button on a region (let's call this "panel") is a child to this panel and a form is a parent to this panel.
Thus, we have a structure - where any object you work with is in some hierarchical relation to some other object.
Structure is shown in a tree-view like display.
Try clicking on something in the "Structure" window. Note how various parts on the "form" get selected.
If your code contains syntax errors, they are displayed in the Errors folder in the Structure View. You can double-click an error to locate its source in the Code Editor. Of course, there are no errors in the Convert it demo application (if there were error you would not be able to run it).
As you will witness in a second, the Structure, Object Inspector and the Form Designer / Code Editor work cooperatively.
If you have an object on a form and click it, its properties and events are displayed in the Object Inspector and the component becomes focused in the Structure view.
Object, huh, Inspector?
Think of your favorite Windows application. There must be some button somewhere on the application's window. When you click this button something happens - it's "click" event is executed. Also, this button might be in color, it has some text ("Caption") and is positioned somewhere.
This button is an object, or a control. It has properties, it responds to events.
You as a programmer will decide how the button looks and what happen when a user of your application clicks on it.
To help you work with the button while designing your application, Delphi has "Object Inspector"!
For example, each form has a Caption (the text that appears on it's title bar). To change the caption of the "Conversion Tester" demo project first activate the form by clicking on it. In the Object Inspector find the property Caption (in the left column), note that it has the 'Conversion Tester' value (in the right column). To change the caption of the form simply type the new text value, like 'Conversion Tester Demo' (without the single quotes).
When you press [Enter] the caption of the form will change.
You are right in thinking that an application must consist of several files. This is where "Project Manager" comes handy.
Within the Project Manager, you can add, remove, and rename files.
You can also combine related projects to form project group, which you can compile at the same time.
Note how Project Manager transform into "Data Explorer" or "Model View" when you click the tab at the bottom of this window.
Unfortunately, it's too early to start explaining what are those used for.
We'll finish this tour with the "Toll Palette"...
The Tool Palette contains items to help you develop your application. The items displayed depend on the current view.
For example, if you are viewing a form on the Designer, the Tool Palette displays controls and components that are you can place on the form.
You can double-click a control to add it to your form. If you are viewing code in the Code Editor, the Tool Palette displays code segments that you can add to your application.
That's it for this lesson. Next time, you'll be starting writing some actual code, I guess.
Welcome to the second part of the free online Delphi programming tutorial: Programming in Delphi For Novices and Non-Programmers!
This series of tutorials is oriented to those who want to take their chance in the world of software development, it is designed to teach the complete beginner (read: "non-programmer") how to become a programmer using Delphi.
In the first lesson, you have downloaded and installed your free version of Delphi: Turbo Delphi Explorer (for Win32 development).
This time, we are going to take a tour of the Delphi IDE - Integrated Development Environment.
The IDE comprises several tools and menus and, in general, helps you visually design user interfaces, set object properties, write code, and view and manage your application in various ways.
Turbo Delphi - "subset of" Borland Developer Studio 2006
Once you are done installing Turbo Delphi, you will have a new folder in the Windows Start - Programs menu: "Borland Developer Studio 2006".Note: By default, Turbo Delphi is installed in the "\Program Files\Borland\BDS\4.0\Bin" folder. "BDS" stands for "Borland Developer Studio" and "4.0" is the version. In short: BDS 4.0 = Borland Developer Studio 2006.
To start Delphi select the "Turbo Delphi" option from the Start - All Programs - Borland Developer Studio 2006 menu.
When Delphi starts (it could even take one full minute to start - depending on your hardware performance) you are presented with the IDE...
What are all those parts of the Turbo Delphi IDE?
Turbo Delphi IDE (Integrated Development Environment)
Like most other development tools, Delphi IDE comprises a number of sections - (dockable) panels.The default IDE desktop layout includes some of the most commonly used tools. You can use the View menu to display or hide certain tools. You can also customize and save the desktop layouts that work best for you. Here are the parts, areas of the IDE, as outlined by the screen shot:
- Menus and Toolbars
- Code Editor, Form Designer, Welcome Page
- Structure View
- Object Inspector
- Project Manager, Model View, Data Explorer
- Tool Palette
Ok, most of the names mean nothing for the moment :)For example: take a look at section marked with 2. This largest part of the IDE is where you will be writing programming code("Code Editor"), designing your application windows /forms ("Form Designer"), open existing projects, read programming blogs, etc. ("Welcome page").
Delphi IDE is "work sensitive" - it will display different sections depending on your current work.
Delphi IDE Menus and Toolbars
The title bar of the IDE window contains the name of the current project (you'll see in some of the future chapters what exactly is a Delphi project). The menu bar includes a dozen drop-down menus - we'll explain many of the options in these menus later through this course.The toolbar provides a number of shortcuts to most frequently used operations and commands - such as running a project, or adding a new form to a project. To find out what particular button does, point your mouse "over" the button and wait for the tooltip. As you can see from the tooltip, for example, point to "Open Project", many toolbuttons have keyboard shortcuts ("Ctrl+F11").
While you have no projects opened in the IDE, the main part of the screen goes to the "Welcome page"...
What should I do on the Turbo Delphi "Welcome Page"?
The Welcome page gets displayed in the center of the Turbo Delphi IDE. You can use it to create new project, open an existing project, launch Delphi help, and similar.
Welcome Page acts as a web browser, you can actually enter a web address in the address bar and surf to your favorite Delphi web site :)
I want to see some Delphi program in Action!
The easiest way to start learning about the other parts of the IDE is to open an existing Delphi demo project and take a scary look at the IDE - how it transforms to the development beast ;)
Where are those Demo Projects Delphi is proud of?
Ok, you might think I'll now show you how to create the good, old "Hello World" type of program with Delphi. Well, not this time. We'll leave this for the next lesson.What I would like to show you is one Delphi application that comes as a demo project.
This way the IDE will have enough to display - for you to get a better understanding of what happens with the IDE as you "activate" different parts of the program.
Here's how to open and run your first Delphi program (ok, I know, it's not yours)
- Select "File - Open Project ..." from the menu.
- The "Open Project" dialog is displayed. Navigate to "Program Files\Borland\BDS\4.0\Demos\DelphiWin32\VCLWin32\ConvertIt".
- Select "ConvertIt.bdsproj" - this is a "Borland Developer Studio Project" type of file. Click on [Open].
- Hit "F9". This is a shortcut for "Run". Yes, yes, we are running a full blown Windows application!
This is a Windows application written in Delphi - and it even does something very smart!
WARNING: IDE has just gone berserk, it turned into what programmers call "debug mode" - help the IDE return to normal state by closing the "Convert It" application - just hit the little [x] button.
I want to show ("deploy" for "geeks") this program to my friend, what more should I do?
Nothing! No really, you have just compiled and run your first Delphi project. There's an EXE file called "ConvertIt.exe" in the same folder where you have found "ConvertIt.bdsproj". Just send this executable to your friend and he/she can work with it. Nothing additional needs to be installed!Why don't you believe? Delphi is that easy: Open, F9 ... and here we have an executable ;)
What's a "Structure" section used for?
Let's now see what else the Delphi IDE is consisted of.
Before I go into detailing other sections of the IDE, select the second tab near the "Welcome page" - the one named "ConvertItUnit".
No, don't bother with what do you see below the tab. Let's concentrate on the other parts of the IDE.
What is a Delphi program made of?
Let's try with a quick and dirty (read: "I cannot explain all at once") approach...A Windows program created with Borland Delphi will at least have one window - let's call this a form.
A form will contain several controls or components, you know : buttons, tabs, drop down selectors, status bar, etc.
Some controls will be child controls to other, for example a button on a region (let's call this "panel") is a child to this panel and a form is a parent to this panel.
Thus, we have a structure - where any object you work with is in some hierarchical relation to some other object.
Structure
The Structure View shows the hierarchy of source code in the Code Editor, or components/controls displayed on the Designer.Structure is shown in a tree-view like display.
Try clicking on something in the "Structure" window. Note how various parts on the "form" get selected.
If your code contains syntax errors, they are displayed in the Errors folder in the Structure View. You can double-click an error to locate its source in the Code Editor. Of course, there are no errors in the Convert it demo application (if there were error you would not be able to run it).
As you will witness in a second, the Structure, Object Inspector and the Form Designer / Code Editor work cooperatively.
If you have an object on a form and click it, its properties and events are displayed in the Object Inspector and the component becomes focused in the Structure view.
Object, huh, Inspector?
Think of your favorite Windows application. There must be some button somewhere on the application's window. When you click this button something happens - it's "click" event is executed. Also, this button might be in color, it has some text ("Caption") and is positioned somewhere.
This button is an object, or a control. It has properties, it responds to events.
You as a programmer will decide how the button looks and what happen when a user of your application clicks on it.
To help you work with the button while designing your application, Delphi has "Object Inspector"!
Object Inspector - the IDE Sheriff!
Each object and each form, has a set of properties ? such as color, size, position, caption ? that can be modified in the Delphi IDE or in your code, and a collection of events ? such as a mouse click, keypress, or component activation ? for which you can specify some behavior. The Object Inspector displays the properties and events (note the two tabs) for the selected object (component) and allows you to change the property value or select the response to some event.For example, each form has a Caption (the text that appears on it's title bar). To change the caption of the "Conversion Tester" demo project first activate the form by clicking on it. In the Object Inspector find the property Caption (in the left column), note that it has the 'Conversion Tester' value (in the right column). To change the caption of the form simply type the new text value, like 'Conversion Tester Demo' (without the single quotes).
When you press [Enter] the caption of the form will change.
You are right in thinking that an application must consist of several files. This is where "Project Manager" comes handy.
Within the Project Manager, you can add, remove, and rename files.
You can also combine related projects to form project group, which you can compile at the same time.
Note how Project Manager transform into "Data Explorer" or "Model View" when you click the tab at the bottom of this window.
Unfortunately, it's too early to start explaining what are those used for.
We'll finish this tour with the "Toll Palette"...
The Tool Palette contains items to help you develop your application. The items displayed depend on the current view.
For example, if you are viewing a form on the Designer, the Tool Palette displays controls and components that are you can place on the form.
You can double-click a control to add it to your form. If you are viewing code in the Code Editor, the Tool Palette displays code segments that you can add to your application.
Closing Delphi IDE
To stop working in the Delphi IDE, you can point to the File | Exit option in the main menu. If you have made changes to the current project, you'll be asked if you want to save the changes. Since Select [No].That's it for this lesson. Next time, you'll be starting writing some actual code, I guess.
Source...