Home

The Borland C++ Builder IDE

 

An Integrated Development Environment

 

Introduction

Borland C++ Builder offers a practical and easy means of creating computer applications for the Microsoft Windows operating systems. It uses the C++ computer language as its core syntax and programming logic, adhering to ANSI standards with a lot of improvements of customized items of the Win32 library. There are various ways you can launch the program. The most common way consists of clicking.

To create a shortcut on the desktop, in Microsoft Windows higher than Win95, you can click Start -> Programs -> Borland Developer Studio 2006, and right-click C++ Builder. You can click Pin To Start Menu to permanently add it to the Start Menu in the same group with Internet Explorer. You can click Send To -> Desktop (Create Shortcut), which would create a Borland C++ Builder shortcut on the desktop.

 

Practical Learning Practical Learning: Launching Borland C++ Builder

  • To start Borland C++ Builder, click Start -> (All) Programs -> Borland Developer Studio 2006 -> C++ Builder
     
 

Integrated Development Environment

An Integrated Development Environment (IDE) is an application that provides a friendly interface for creating computer programs. Borland C++ Builder’s IDE is structurally a classic application. On top, there is a title bar that displays the name of the application and the program currently running. The title bar itself is made of three sections.

The Title Bar

The title bar is a horizontal bar that signals the application to the operating system:

The title bar displays the system icon . The system icon is used to identify the application you are using. Almost every application has its own system icon. The system icon holds its own list of actions; for example, it can be used to move, minimize, maximize or close (when double-clicked) a window. These actions are available through a menu that displays when you click the system icon:

The main section of the title bar displays Borland Developer Studio 2006. On the right section of the title bar, there are three system buttons with the following roles:

Button Role
Minimizes the window
Maximizes the window
Restores the window
Closes the window

Under the title bar, the main menu displays its various groups of menu items. To use a menu, you click one of the words and the menu expands.

In this book, the word “Main Menu” refers to the menu on top of the IDE

The About dialog box allows you to get some information about Borland C++ Builder and the operating system. To access the About dialog box, on the main menu, you can click Help -> About Borland C++ Builder ®. Alternatively, on the right side of the main menu, there is a C++ Builder button . If you click the button, the About dialog box would display:

From now on, in this book,

Press Means
T Press the T key
Alt, G Press and release Alt. Then press G
Ctrl + H Press and hold Ctrl. While you are still holding Ctrl, press H once. Then release Ctrl
Ctrl + Shift + E Press and hold Ctrl. Then press and hold Shift. Then press E once. Release Ctrl and Shift
 

The Toolbars

A toolbar is an object made of buttons. These buttons provide the same features you would get from the menu, only faster. Under the menu, the IDE is equipped with various toolbars. To see the list of available toolbars, you can right-click the one under the main menu:

You can move a toolbar from its default position to another area on the screen. To do this, you can click and drag it away. To position the toolbar back or to somewhere else, you can drag its title bar to the desired location

In this book, every toolbar is referred to by its name
 

Toolbar Name Illustration
Standard
Debug
Desktop
Browser
View
Custom

A toolbar is equipped with buttons that could be unpredictable. Just looking at one is not obvious. The solution into knowing what a button is used for is to position the mouse on top of it. A tool tip also called a hint will come up and display for a few seconds:

Borland C++ Builder Projects

 

Project Creation

To create q computer application in Borland C++ Builder, you start with a project. A project is a collection of files that, when put together, represent an object that can be executable on other computers that don't have Borland C++ Builder. There are different types of applications you can create and thus different ways to start a project. In this book, we will learn how to create graphical programs, also called Windows applications.

To create a Windows application, on the main menu, you can click File -> New -> VCL Forms Application - C++ Builder:

This action starts a project and displays a rectangular object called a form.

Practical Learning Practical Learning: Creating a Project

  • On the main menu, click File -> New -> VCL Forms Application - C++ Builder 

Saving a Project

Borland C++ Builder allows you to create an "experimental" application that would disappear when you close Borland C++ Builder. To use such an experimental application, start by creating a project, do whatever you want with it, including adding other items and resources as we will see throughout this book. While using the project, don't save it. If you want to keep everything you have done in a project and continue it another time, you must save the project. Also, if you want to be able to distribute your application to other computers, you must save it.

To save a project, on the main menu, you can click File -> Save All or File -> Save Project As... An alternative is to click the Save All button from the Standard toolbar. When saving a project, you must specify (or create) a folder for the project. You must specify a name for the project and you must name each file used in your application.

Practical Learning Practical Learning: Saving a Project

  1. On the Standard toolbar, click Save All Save All
  2. Type Exercise to replace the name of the Unit1
  3. Click the Create New Folder button
  4. Type Exercise01 and press Enter
  5. Double-click Exercise01 to display it in the Save In combo box
  6. Click Save
  7. Type Exercise1 to replace the name of the project
  8. Click Save

Program Execution

A program would not mean much unless it accomplishes the desired purpose. To examine how your development is proceeding, as a beginning programmer, you should regularly ask C++ to show you the result.

There are three ways you can execute a program in Borland C++ Builder. To execute a program, you can press F9. You can also use the main menu where you would click Run -> Run. On the toolbar, you can also click the Run button Run. Remember that you can do almost anything without, or before, saving a project. This means that you can execute a project even if it has not been saved already.

Practical Learning Practical Learning: Executing a Program

  • On the Debug toolbar, click the Run button Run

The Code Editor

Besides designing applications, one of your most regular jobs will consist of writing code that directs the computer as to what to do, when, and how to do it. This is done in an appropriate window called the Code Editor.

The Code Editor is a featured text editor adapted for coding purposes. It is programmed to recognize the parts of a program that are recognized by C++ or not. To access the Code Editor, if you have a form opened, you can press F12. The Code Editor manages your jobs by organizing its files into property pages (also called tabs). If your project contains more than one file, you can click the desired tab to access one of the files.

The basic building block of a program is called a C++ file. Whenever you create a new project, the Borland C++ Builder programming environment creates a C++ file called Unit1 while the project is called Project1. If you want, you can change these names by saving the project. A typical code of a form is built from at least two files: a header file and a source file. By default, Borland C++ Builder does not display this file when a project has been created; you have to request it.

To display the header file of the form, you can right-click the source file and click Open Source/Header File. Indeed, this action is used to toggle both displays. Since the source and the header file go in pair (when using classes), they hold the same name but have different extensions:

The Code Editor

To change the displaying of the form and its code, on the main menu, you can click View -> Toggle Form/Unit. At any time, for example if the programming environment is displaying something other than the form, to display the form, on the main menu, you can click View -> Forms... This would display the list of forms of the application. You then click the desired form and click OK.

Practical Learning Practical Learning: Exploring the Code Editor

  1. To display the header file, press Ctrl + F6
  2. To toggle between the form and its unit, press F12
  3. To bring back the Code Editor, press F12
  4. Click Exercise.cpp
  5. To bring back the form, press F12

Borland C++ Builder Help

 

Overview

There are two main sources of help available for Borland C++ Builder. The first source of help is provided with the programming environment. This help is mainly electronic. You have access to this help even if you are not designing an application. Everything considered, this is the closest and the highest documentation that the compiler provides. To access C++ Builder help, on the task bar, you can click Start -> (All) Programs -> Borland Developer Studio 2006 -> Documentation.

Practical Learning Practical Learning: Using Online Help

  1. On the main menu, click Help -> Borland Help
  2. Click the Index tab
  3. In the Look For combo box, type AnsiStr
     
  4. Notice that the Help environment finds the closest matches
  5. In the list, click AnsiStrComp
  6. Notice the options in the lower-right section of the window
  7. Double-click the second option that has C++ Builder Reference
     
  8. Notice that the main right section of the window displays the details of the item selected
     
  9. Close the Borland Help window and return to Borland C++ Builder
  10. On the main menu, click View -> Units...
  11. In the View Unit window, click Exercise1 and click OK
  12. In the Code Editor, click the word CreateForm
  13. Press F1
     
  14. Under Title, double-click TApplication::CreateForm Method
  15. Notice that Borland Help opens and displays an explanation of the item that was selected
  16. Close the Borland Help window 

Internet Help

Another place you can find information is on the Internet. Fortunately, most of that help is free. On the company’s web site, you can access http://bdn.borland.com.

Because a great part of the Borland C++ Builder applications implement the Win32 API, it is very important that you have access to the Microsoft Developer Network documentation. It is available free from http://msdn.microsoft.com and on CD-ROM or DVD.

Practical Learning Practical Learning: Exploring Internet Help

  1. Log on to http://www.borland.com
  2. Look for and click C++ Builder
  3. After finding some information and reading, change the address in the Address box to http://msdn.microsoft.com and press Enter
  4. Position the mouse on Libraries and click Developer

 

 
 
Copyright © 2004-2007 Yevol Next