Gift Guide

Client/Server Developer's Guide with Delphi 3

( 1 )


Client/SErver Developer's Guide with Delphi 3 takes an authorative, real-world approach to learning database designa nd creating full-featured client/server applications. Focusing on the more advanced features and topics, this guide enables you to become a proficient Delphi developer. Written by an industry expert, Client/Server Developer's Guide with Delphi 3 offers sound advice to help you fully understand this powerful development environment and use it to your advantage. With tips, techniques, and practical ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (6) from $1.99   
  • New (1) from $0.00   
  • Used (5) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2006

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

Shows some signs of wear, and may have some markings on the inside. 100% Money Back Guarantee. Shipped to over one million happy customers. Your purchase benefits world literacy!

Ships from: Mishawaka, IN

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2009

Feedback rating:


Condition: Good
Light shelving wear with minimal damage to cover and bindings. Pages show minor use. Help save a tree. Buy all your used books from Green Earth Books. Read. Recycle and Reuse.

Ships from: Portland, OR

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2014

Feedback rating:


Condition: Acceptable
CD Missing. Free State Books. Never settle for less.

Ships from: Halethorpe, MD

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2009

Feedback rating:


Condition: Good
Book shows a small amount of wear to cover and binding. Some pages show signs of use. Sail the Seas of Value

Ships from: Windsor Locks, CT

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Seller since 2014

Feedback rating:


Condition: Good
1997 Other Illustrated. Good. Sams Developer's Guides.

Ships from: Pueblo West, CO

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Sort by
Sending request ...


Client/SErver Developer's Guide with Delphi 3 takes an authorative, real-world approach to learning database designa nd creating full-featured client/server applications. Focusing on the more advanced features and topics, this guide enables you to become a proficient Delphi developer. Written by an industry expert, Client/Server Developer's Guide with Delphi 3 offers sound advice to help you fully understand this powerful development environment and use it to your advantage. With tips, techniques, and practical examples, this resource delivers the information you need to improve your skills, expand your knowledge, and achieve optimum results.
Read More Show Less

Product Details

  • ISBN-13: 9780672310249
  • Publisher: Sams
  • Publication date: 7/28/1997
  • Edition description: BK&CD-ROM
  • Pages: 1000
  • Product dimensions: 7.34 (w) x 9.08 (h) x 2.11 (d)

Table of Contents

[Figures are not included in this sample chapter]

Client/Server Developers Guide Delphi 3


  • Introduction - xxvii

I - Getting Started

  • Chapter 1 - Is Delphi the Silver Bullet?

    • Why Delphi?
    • No Limits
    • Scalability
    • What's Ahead
    • Summary

  • Chapter 2 - Quick Start

    • A Few Words First
    • An Overview of the Architecture
    • A Simple Form
    • Building Database Applications
    • The TDatabase Component
    • BDE Aliases
    • Data Modules
    • Creating a Master/Detail Form
    • Summary
    • What's Ahead

  • Chapter 3 - Building Blocks

    • What Are Projects?
    • Delphi Projects
    • Delphi Libraries
    • Delphi Units
    • Delphi Forms
    • Data Modules
    • Include Files
    • Delphi Components
    • Summary
    • What's Ahead

  • Chapter 4 - Conventions

    • Object Pascal Program Elements
    • Object Pascal Coding Styles
    • Database Server Constructs
    • Summary
    • What's Ahead

  • Chapter 5 - A No-Nonsense Approach to SQL

    • Quick Start
    • A Few Additional Comments
    • Summary
    • What's Ahead

  • Chapter 6 - Client/Server Database Design

    • General Approach
    • The Five Processes
    • On the Complexities of Client/Server Development
    • Defining the Purpose of the Application
    • Defining the Functions of the Application
    • Designing the Database Foundation and Application Processes
    • Summary
    • What's Ahead

  • Chapter 7 - Client/Server Application Design

    • Designing the Database Foundation and Application Processes
    • Test the Application for Compliance with the Predefined Purpose

      and Functions
    • Installing the Application for Production Use
    • Summary
    • What's Ahead

II - Tutorial -

  • Chapter 8 - Your First Real Client/Server Database Application

    • Defining the Purpose of the Application
    • Defining the Functions of the Application
    • Designing the Database Foundation and Application Processes
    • Summary
    • What's Ahead

  • Chapter 9 - First Steps

    • Construct RENTMAN's Database Foundation
    • Determine the Type of Application You're Building
    • Derive Application Objects from Application Processes
    • Design a Form Hierarchy
    • Begin Building the Application
    • Summary
    • What's Ahead

  • Chapter 10 - First Forms

    • Silverrun-RDM and Delphi Mode
    • Customize the Data Module
    • The EMPLOYEE Quick Entry/Edit Form
    • The Work Type Quick Entry/Edit Form
    • Summary
    • What's Ahead

  • Chapter 11 - Forms, Forms, and More Forms

    • The TENANT Form
    • The PROPERTY Form
    • The LEASE Form
    • The WORDER Form
    • Overriding DBNavigator
    • The CALL Form
    • Summary
    • What's Ahead

  • Chapter 12 - Reports

    • Methods of Building Delphi Reports
    • Types of Reports
    • The Work Order Form Report
    • Property-List Columnar Report
    • The Task-List Report
    • Inside TaskList1Click
    • Summary
    • What's Ahead

  • Chapter 13 - Finishing Touches

    • Adding an Application Bitmap
    • Specifying the Application's Title and Icon
    • Adding Windows Help
    • Adding Fly-Over Hints
    • Activating the Status Bar
    • Adding an About Box
    • Adding a Form-Print Button
    • Adding Report-Confirmation Dialogs
    • Summary
    • What's Ahead

  • Chapter 14 - RENTMAN Postpartum

    • Testing the App
    • Deploying the App
    • Summary
    • What's Ahead

III - Reference

  • Chapter 15 - Delphi on Microsoft SQL Server

    • Starting the Server
    • Getting Connected
    • SQL Primer
    • Summary
    • What's Ahead

  • Chapter 16 - Delphi on Oracle

    • Starting the Server
    • Getting Connected
    • SQL Primer
    • Summary
    • What's Ahead

  • Chapter 17 - Delphi on InterBase

    • Starting the Server
    • Getting Connected
    • SQL Primer
    • InterBase Administration
    • Summary
    • What's Ahead

  • Chapter 18 - Delphi on Sybase SQL Server

    • Starting the Server
    • Getting Connected
    • Net Library/Open Client Error 422 Under NT
    • Configuring the Client
    • SQL Primer
    • Summary
    • What's Ahead

IV - Advanced Topics

  • Chapter 19 - Business Reports

    • Types of Reports
    • The Employee Database
    • The Customer List Report
    • The Customer Group Report
    • The Master/Detail Report
    • The Cross-Tab Report
    • Constructing a Report Front-End Program
    • Viewing Your Reports at Runtime
    • Business Charts
    • Enhancing Your Reports
    • Summary
    • What's Ahead

  • Chapter 20 - Business Rules on the Database Server

    • Business Rules Further Defined
    • Server-Based Business Rule Implementations
    • Server Implementation Strengths
    • Server Implementation Weaknesses
    • Client Implementation Strengths
    • Client Implementation Weaknesses
    • Middleware Strengths
    • Middleware Weaknesses
    • Implementing Server-Based Business Rules
    • Summary
    • What's Ahead

  • Chapter 21 - Business Rules in Delphi Applications

    • Types of Business Rules
    • Two Rules About Business Rules
    • Custom Components
    • TField Properties and Business Rules
    • DataSets and Business Rules
    • Summary
    • What's Ahead

  • Chapter 22 - Beyond the Two-tiered Model

    • Remote Data Broker
    • Constraint Broker
    • Briefcase Computing Support
    • Partial Data Packages
    • Summary
    • What's Ahead

  • Chapter 23 - Concurrency Control

    • Transaction Isolation
    • Concurrency Control Systems
    • Transaction Log Management
    • Summary
    • What's Ahead

  • Chapter 24 - Advanced SQL

    • DDL Versus DML
    • Advanced DDL Syntax
    • Advanced DML Syntax
    • Optimal SQL
    • Summary
    • What's Ahead

  • Chapter 25 - Delphi Client/Server Performance Tuning

    • How Fast Is Fast Enough?
    • Determine Performance Variables
    • Build a Test Environment
    • Defining Performance Tuning
    • Application Performance Tuning
    • Server Performance Tuning
    • Network Performance Tuning
    • Summary
    • What's Ahead

  • Chapter 26 - The Borland Database Engine

    • BDE Versus ODBC
    • The Architecture
    • The BDE API
    • Building a Native BDE Application
    • Accessing the BDE from Delphi Applications
    • Making Native Calls to Your DBMS
    • Retrieving Platform-Specific Info Using the BDE
    • Expression Indexes
    • Optimizing the BDE
    • Optimizing BDE for SQL Access
    • Summary
    • What's Ahead

    • Chapter 27 - Building Your Own Database Components
    • The Four Basics of Component Construction
    • TArrayTable
    • TLiveQuery
    • TDBNavSearch
    • The ZoomDlg Component
    • Summary
    • What's Ahead

  • Chapter 28 - Delphi Internet Applications

    • Project One: A Web Browser
    • Project Two: A Web Server App
    • Project Three: An ActiveForm Application
    • Project Four: A Thin-Client App
    • Project Five: Building a Shopping Cart
    • Summary
    • What's Ahead

  • Chapter 29 - Deploying Your Applications

    • Get Organized
    • Ascertain Client Network Requirements
    • Determine Client Database Driver Requirements
    • Evaluate Client Database Server Requirements
    • Ascertain Database Preparation Requirements
    • Basic Setup
    • Advanced Setup
    • Installing Database Objects
    • Summary


  • A - A Roadmap for the Journey to Delphi

    • C and C++
    • PowerBuilder
    • Visual Basic and Access
    • The Xbase Dialects: dBASE, Clipper, FoxPro, and So On
    • Conclusion
    • Summary

  • Index

Read More Show Less

First Chapter

[Figures are not included in this sample chapter]

Client/Server Developers Guide Delphi 3

- 3 -

Building Blocks

Although Client/Server Developer's Guide with Delphi 3 isn't intended to
be a beginner's book, I thought it appropriate to touch briefly on the building blocks
of Delphi applications. You might be coming from a development environment that differs
significantly from Delphi. If so, a brief discussion of Delphi basics will be beneficial.
If you're familiar with Delphi concepts and have already begun developing applications,
you might want to skip this chapter and go straight to Chapter 4, "Conventions."

In this chapter, you learn the pieces that make up the Delphi puzzle. You are
introduced to Delphi projects and libraries. You get acquainted with Object Pascal
units, forms, data modules, and include files. Last, but not least, you meet the
cornerstone of Delphi application development: the component.

What Are Projects?

Depending on the software you're using, the term project can have a number
of different meanings. Usually, a project is the top-level container for all the
objects in an application. Its purpose is to relate the files that make up an application
to one another--to establish dependency relationships between them. A single project
usually acts as the repository for all the objects in an application. Of course,
this isn't always the case. Sometimes an application is composed of multiple projects.
Sometimes a project covers more than just a single application. In most development
tools, though, a project produces a single executable file.

Delphi Projects

In Delphi, a project contains a master list of all the files that constitute a
single application. Delphi projects are unusual in that, aside from listing the application's
source code modules, they also function as program source code. That is, a Delphi
project is Object Pascal source code that you can view and modify if necessary.

NOTE Although it is possible to modify a Delphi project file manually, you
shouldn't need to do so. Because Delphi might change parts of the file, you shouldn't
make your own changes to it. A change you make could confuse Delphi, or Delphi might
overwrite changes you've made to the file.

Because Delphi projects are stored as source code and reside in the operating
system as files, project names are limited only by Pascal's identifier restrictions.
Project and unit names must begin with a letter and may include letters, digits,
and underscores. No spaces or periods are permitted. Listing 3.1 shows a small Delphi
project file.

NOTE Of course, the maximum filename length that your operating system supports
affects the names you can use for files. Some network operating systems, notably
Novell NetWare 3.x, don't support long filenames. This is also true of some
version control systems. You'll need to take this into account as you name your files.

Listing 3.1. The RENTMAN project file.

program RENTMAN;
RENTDATA in `RENTDATA.pas' {dmRENTMAN: TDataModule},
ANYFORM in `..\..\CH09\CODE\ANYFORM.pas' {fmAnyForm},
DBFORM in `..\..\CH09\CODE\DBFORM.pas' {fmDatabaseForm},
EDITFORM in `..\..\CH09\CODE\EDITFORM.pas' {fmEditForm},
CGRDFORM in `..\..\CH09\CODE\CGRDFORM.pas' {fmControlGridForm},
MSTRFORM in `MSTRFORM.pas' {fmMasterDetailForm},
GRIDFORM in `GRIDFORM.pas' {fmGridForm},
{$R *.RES}
Application.HelpFile := `C:\Data\Word\CSD\CH13\code\Rentman.hlp';
Application.CreateForm(TfmRSYSMAN0, fmRSYSMAN0);
Application.CreateForm(TdmRENTMAN, dmRENTMAN);
Application.CreateForm(TfmREMPENT0, fmREMPENT0);
Application.CreateForm(TfmRWKTENT0, fmRWKTENT0);
Application.CreateForm(TfmRTENCGD0, fmRTENCGD0);
Application.CreateForm(TfmRPROCGD0, fmRPROCGD0);
Application.CreateForm(TfmRLEACGD0, fmRLEACGD0);
Application.CreateForm(TfmRWORGRD0, fmRWORGRD0);
Application.CreateForm(TfmRWORMDE0, fmRWORMDE0);
Application.CreateForm(TfmRCALGRD0, fmRCALGRD0);
Application.CreateForm(TfmRCALEDT0, fmRCALEDT0);
Application.CreateForm(TfrRPROLST0, frRPROLST0);

The program Keyword

Note the use of the program keyword in Listing 3.1. It tells the compiler
that this file is to become its own executable. In a dynamic link library or unit,
the program keyword is replaced with library or unit,

The Uses Statement

The Uses statement lists the Object Pascal units that Delphi links to
build the executable. Units are the molecules of Delphi applications. Any
unit whose source code is more recent than its compiled code is automatically recompiled
when you compile or run the project file. Some environments refer to this as a make.

The Forms unit in Listing 3.1 is part of Delphi's own Visual Component
Library and defines the characteristics of Delphi forms. The other units listed correspond
to the forms that have been added to the project. Each line lists the name of the
unit, the operating system file in which it resides, and the name of the form that
the unit contains. Each form name reflects the value of its Name property
in the Delphi Object Inspector. With the advent of long filename support in Delphi,
the name of the unit and the name of the file in which it resides are identical,
minus, of course, the file's extension. If, during compilation, the Delphi compiler
can't find a unit using its long name, it will attempt to find it using its truncated,
or short, name.

The $R Directive

The $R compiler directive instructs the compiler to include the specified
Windows resource with the project. The asterisk tells the compiler that the resource
file has the same base name as the project. When you build a project, Delphi creates
a resource file for the project itself and for each of its forms. If these resource
files are not present when the application is linked, Delphi issues a File not
found xxx.RES


The Application.CreateForm statements load the project's forms into memory.
Usually, every form in a project is listed here. Using the Options | Project menu
selection in the Delphi Integrated Development Environment (IDE), you can control
whether a form is created automatically for you. Each form is stored in its form
instance variable (for example, fmRSYSMAN0), which is defined in the interface
section of the form's unit. Because the project file uses the units that define the
form instance variables, it can "see" these variables and pass each of
them to the Application.CreateForm routine. Application.CreateForm
then loads the specified form into memory and returns a pointer to it in the instance

The order in which the Application.CreateForm statements are listed is
significant in that it determines the order in which the forms are created. The first
form created by Application.CreateForm is the application's main form. If
you want to change the order of form creation, use the Project | Options | Application
menu selection; don't edit your project source code file.


Application.Run starts the ball rolling as far as your application is
concerned. It enters the loop that runs your application.

Delphi Libraries

Delphi provides a convenient mechanism for building Windows dynamic link libraries
(DLLs). Unlike most other Windows programming languages, Delphi actually includes
special syntax for building DLLs. You use two keywords to implement Delphi's DLL
support: library and export. The library keyword takes
the place of the program keyword in the previous example. It tells Delphi
to build a DLL rather than an EXE file. The export keyword causes the DLL
to actually export the functions so that other executables can call them. Listing
3.2 is the source code to a small library.

Listing 3.2. The StrUtil library.

library StrUtil;
function Pad(InString: String; Len: Integer): String;
Result:=Format(`%-*s',[Len, InString]);
function LPad(InString: String; Len: Integer): String;
Result:=Format(`%*s',[Len, InString]);
Pad index 1,
LPad index 2;

Libraries are very similar in form to programs. Note the use of the library
keyword in place of Program at the top of Listing 3.2. The exports
statement tells Delphi to export the Pad and LPad routines from
the DLL so that other executables can call them.

Delphi Units

Along with forms, units are the molecular building blocks of Delphi applications.
Units house the forms that make up your application's visual appearance. Additionally,
they store supplemental code that you write to support application functions.

Each form you add to your project comes with its own unit source. This unit source
contains a class definition that is a reflection of the visual representation of
the form. For each component you add to the form, Delphi's form designer modifies
the class definition to reflect the new component. Each time you add an event handler
to the form, the event handler code is stored in the unit file. Nearly all the coding
you do in Delphi is done in unit files. Listing 3.3 is the source to a simple unit

Listing 3.3. The source to a Delphi unit.

unit RTENCGD0;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
CGRDFORM, Buttons, DBCtrls, StdCtrls, ExtCtrls, Mask, DBNavSch, DBCGrids;
TfmRTENCGD0 = class(TfmControlGridForm)
teTenantNo: TDBText;
deName: TDBEdit;
deEmployer: TDBEdit;
deEmpAddress: TDBEdit;
deEmpCity: TDBEdit;
deEmpState: TDBEdit;
deEmpZip: TDBEdit;
deHomePhone: TDBEdit;
deWorkPhone: TDBEdit;
deICEPhone: TDBEdit;
deLeaseBeginDate: TDBEdit;
deLeaseEndDate: TDBEdit;
deMovedInDate: TDBEdit;
deMovedOutDate: TDBEdit;
deRentDueDay: TDBEdit;
dePetDeposit: TDBEdit;
deComments: TDBEdit;
Label1: TLabel;
dkLawnService: TDBCheckBox;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: Tlabel;
laName: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
{ Private declarations }
{ Public declarations }
DefaultPetDeposit : Integer;
uses rentdata;
{$R *.DFM}

The interface Section

Note the division of the unit into the interface, implementation,
and initialization sections. The interface section contains the
header information for the unit. This includes the function and procedure declarations
and the variable, constant, and type definitions you want to be visible to the outside
world. For you C programmers out there, this is the equivalent of C's header file.
Unlike C, you don't need to store this section in a separate source code file so
that other modules can include it. A compiled unit stores its interface information
in its header. When another module references this unit in its Uses statement,
Delphi looks at the header of the compiled unit, not its source code, to determine
the interface it presents.

This approach enables you to distribute Delphi units as object code only--without
requiring header files of any kind. Furthermore, it does away with the redundancy
of recompiling a header file each time a module that includes it is compiled. (Precompiled
header files address this issue to an extent, but not all C compilers support them.)
This approach is better than that taken by many C compilers and represents the next
logical step beyond header files.

The implementation Section

The implementation section contains the unit's actual programming code.
Items you place here are visible only to the unit itself unless you also list them
in the interface section. The typical organization of a unit places a function's
declaration in the interface section and its code in the implementation

The form instance Variable

Note the form instance variable in the var section of the unit's


This defines a variable named fmRTENCGD0 as type TfmRTENCGD0.
TfmRTENCGD0 is a descendant of the TForm class created for you
by Delphi's visual form designer. fmRTENCGD0 is the variable that the project
file initializes when it calls Application.CreateForm. Because this variable
is defined in the interface section of the unit, other modules that reference
the unit in their Uses clauses, including the project file, can "see"
the variable and modify it if they want.

The initialization Section

When you need to set up code that executes when a unit is first loaded, put it
in the unit's initialization section. Anything placed here is executed when
the application loads. The order in which a given unit's initialization
code executes is determined by the unit's position in the project source file's Uses
statement. In Listing 3.3, the initialization section consists of the lines
between the word initialization and the end of the unit:


When the application is first loaded, the DefaultPetDeposit variable
is initialized to 150. The application can then reference the variable without
being concerned with first initializing it.

The finalization Section

You can optionally include a finalization section in the Delphi units
you construct. Code in the finalization section executes when the application
shuts down. This is a good place to close files you've opened and free other resources
the unit might have used. This section must appear after the initialization
section but before the unit's last end.

Delphi Forms

Delphi forms provide your application's onscreen appearance. Most of the design
work you do in Delphi's visual form designer is stored in a form file. When you set
a property or move a component, you are modifying settings that are stored in the
module's form file.

Because Delphi's tools are true two-way tools, it's possible to edit a form as
text, save it, and then see the changes you made reflected visually. Listing 3.4
is the text version of a small form.

Listing 3.4. The text representation of a simple form.

inherited fmDatabaseForm: TfmDatabaseForm
Left = 75
Top = 124
Width = 554
Caption = `fmDatabaseForm'
PixelsPerInch = 96
TextHeight = 13
inherited paTop: TPanel
Width = 546
inherited paMiddle: TPanel
Width = 546
inherited paBottom: TPanel
Width = 546
object paRight: TPanel
Left = 385
Top = 1
Width = 160
Height = 37
Align = alRight
BevelOuter = bvNone
TabOrder = 0
object bbOK: TBitBtn
Left = 4
Top = 8
Width = 75
Height = 25
TabOrder = 0
Kind = bkOK
object bbCancel: TBitBtn
Left = 82
Top = 8
Width = 75
Height = 25
TabOrder = 1
Kind = bkCancel
object bbPrintForm: TBitBtn
Left = 280
Top = 8
Width = 75
Height = 25
Caption = `Print Form'
TabOrder = 1
OnClick = bbPrintFormClick
Glyph.Data = {
NumGlyphs = 2
object DBNavigator1: TDBNavSearch
Left = 8
Top = 8
Width = 253
Height = 25
TabOrder = 2

Data Modules

Delphi supports a special type of form known as a data module. You create
a data module by selecting New Data Module from Delphi's File menu. Data modules
enable you to group non-visual controls--usually database components--onto a central
form. You can then reference these data modules from other forms in the application
in order to access their database components. You can also add data modules to Delphi's
Object Repository and inherit, copy, or use them, like other Repository members.
Note that you can't drop visual controls onto a data module--only non-visual controls
are allowed.

Include Files

Like most language tools, Delphi's compiler supports include files. Include
enable you to establish common sections of code you want to share among
a number of modules. Because Delphi recompiles include files each time it encounters
them in source code, you'll want to restrict their use and utilize units instead
whenever possible.

A common use of an include file is to list compiler directives common to several
units and to cause those units to be automatically recompiled when you alter the
contents of the include file. The following segment is an example of such a file
from the WinMac32 Windows Macro Engine source:


NOTE You can find the complete WinMac32 source code on the CD-ROM included
with this book.

The primary purpose of the code is to enable you to easily toggle compiler options
related to debugging. Note the {$IFNDEF DEBUG} line. It simply states that
if you haven't defined a custom compiler directive named DEBUG, the three
options related to debugging--$D, $L, and $Y--should be
switched off. By switching off just the $D option, you automatically turn
off the other two. Conversely, if you've defined DEBUG, the three options
are switched on. If all the modules in an application include this file, you can
easily toggle whether they are compiled with debugging related switches enabled by
defining or undefining the DEBUG switch. To me, this is simpler than toggling
the three options in the Delphi Options | Project dialog box.

After the file is defined, you include it in your source code files by using the
$I compiler directive, like so:


NOTE Conditional compiler directives are not carried across units, as you
might expect. Each time Delphi's compiler begins compiling a new unit, it resets
the current set of conditional directives to those defined in the Project | Options
dialog or on the compiler's command line.

Delphi Components

If forms are Delphi's molecular building blocks, components are the atoms that
make up those molecules. You combine them to build forms, just as atoms combine to
make molecules.

Behind the visual representation you see in Delphi's form designer, components
are composed of Object Pascal source code. Listing 3.5 lists the source code to a
simple component.

Listing 3.5. Custom code for a new component--TArrayTable.

ArrayTable Delphi Component
Provides an array-like interface to a table.
Use the syntax:
to access individual field values.
Written by Ken Henderson.
Copyright (c) 1995 by Ken Henderson.
unit ArrayTable;
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables;
TArrayTable = class(TTable)
{ Private declarations }
function GetRecords(RecNum : Longint) : TDataSet;
{ Protected declarations }
{ Public declarations }
property Records[RecNum : Longint] : TDataSet read GetRecords;
{ Published declarations }
procedure Register;
function TArrayTable.GetRecords(RecNum : Longint) : TDataSet;
procedure Register;
RegisterComponents(`Data Access', [TArrayTable]);

This component subclasses Delphi's Table component and adds a single public property
to it: Records. Records enables you to treat the table as one large
array. For example, the following syntax returns the third field from the fifth record
in the table as a string (both the new Records property and TTable's
own Fields property are zero based):


As you can see, this added functionality came at a very small price. The process
was even simpler with Delphi's New Component option on the Component menu. Using
the New Component option, you specify the ancestor class (in this case, TTable),
the name of the new class, and the page on which it is to reside. Delphi then generates
the necessary source code for you.

NOTE Something that might not be obvious from looking at TArrayTable's
source code is that using the Records property physically moves the record
pointer. Because of the nature of Delphi's database controls, there's no way around
this. Setting a bookmark from within the component wouldn't be of any use because
TTable's Fields property always points to the current record. In
code that uses this component, you might want to use a bookmark to save your position
in the table so that you can return to it after the reference to the Records

Note the Register procedure at the end of Listing 3.5. A Delphi component
is added to the toolbar palette via the RegisterComponents procedure. Its
first parameter denotes the toolbar palette page on which the new component is to
reside. The second parameter lists the component to register. Separate multiple component
names with commas (within the brackets).


In this chapter, you learned about the building blocks of which Delphi applications
are made. Specifically, you were introduced to the following elements:

  • Projects--A project is the collection of files that make up a Delphi application.

  • Libraries--A library is a Windows dynamic link library (DLL); it exports
    routines for other modules to use.

  • Units--In conjunction with forms, units are the molecular building blocks
    with which Delphi applications are built.

  • Forms--Forms constitute the visual representation of a Delphi application.

  • Include Files--Include files are used to share code snippets among multiple
    source code modules.

  • Components--Components are the atomic building blocks with which forms
    and, hence, units are made.

What's Ahead

In the next chapter, I introduce some standard naming and coding conventions.
The subject of conventions is no one's favorite; it's about as intriguing as a book
on dental flossing. Nevertheless, establishing sound standard guidelines on naming
objects and structuring program code can save you many headaches down the road.

Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted August 8, 2000

    Wonderful book -- over the top

    Just found this in a bricks-and-mortar bookstore and had to get on here and rave about it. This is a wonderful book. Such attentiont to detail. Such a lucid, conversational style. Such oodles of useful technical info. This book is a one-in-a-million. If you're serious about Delphi, get this book -- there are no others like it.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)