0% found this document useful (0 votes)
16 views65 pages

Developers Guide Delphi 6 For Windows download

The document is a guide for developers using Delphi 6 for Windows, detailing its features, components, and programming techniques. It includes links to additional resources and related products for Delphi development. The guide covers topics such as application development, component libraries, and common programming tasks.

Uploaded by

nbjtcfjyr629
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views65 pages

Developers Guide Delphi 6 For Windows download

The document is a guide for developers using Delphi 6 for Windows, detailing its features, components, and programming techniques. It includes links to additional resources and related products for Delphi development. The guide covers topics such as application development, component libraries, and common programming tasks.

Uploaded by

nbjtcfjyr629
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

Developers Guide Delphi 6 For Windows download

https://ebookbell.com/product/developers-guide-delphi-6-for-
windows-1021628

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Delphi 6 For Windows Developers Guide Borland

https://ebookbell.com/product/delphi-6-for-windows-developers-guide-
borland-6760192

Borland Delphi 6 Developers Guide Steve Teixeira Xavier Pacheco

https://ebookbell.com/product/borland-delphi-6-developers-guide-steve-
teixeira-xavier-pacheco-6760318

Developers Guide Borland Delphi 7 For Windows Borland Software


Corporation

https://ebookbell.com/product/developers-guide-borland-delphi-7-for-
windows-borland-software-corporation-36903922

The Tomes Of Delphi Developers Guide To Troubleshooting Wordware


Delphi Developers Library Clay Shannon

https://ebookbell.com/product/the-tomes-of-delphi-developers-guide-to-
troubleshooting-wordware-delphi-developers-library-clay-
shannon-1474192
Delphi Developers Guide To Xml Keith Wood

https://ebookbell.com/product/delphi-developers-guide-to-xml-keith-
wood-984346

Delphi For Net Developers Guide Xavier Pacheco

https://ebookbell.com/product/delphi-for-net-developers-guide-xavier-
pacheco-5903518

Delphi 7 For Windows Developers Guide Borland

https://ebookbell.com/product/delphi-7-for-windows-developers-guide-
borland-6773342

Developers Guide To Microsoft Prism 4 Building Modular Mvvm


Applications With Windows Presentation Foundation And Microsoft
Silverlight 1st Edition Bob Brumfield

https://ebookbell.com/product/developers-guide-to-microsoft-
prism-4-building-modular-mvvm-applications-with-windows-presentation-
foundation-and-microsoft-silverlight-1st-edition-bob-brumfield-2120280

Developers Guide To Multiplayer Games Wordware Game Developers Library


Andrew Mulholland

https://ebookbell.com/product/developers-guide-to-multiplayer-games-
wordware-game-developers-library-andrew-mulholland-2140102
Developer’s Guide

Borland®

Delphi 6
for Windows
Borland Software Corporation
100 Enterprise Way, Scotts Valley, CA 95066-3249
Refer to the DEPLOY document located in the root directory of your Delphi 6 product for a complete list of files that
you can distribute in accordance with the Delphi 6 License Statement and Limited Warranty.
Inprise may have patents and/or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents.
COPYRIGHT © 1983, 2001 Borland Software Corporation. All rights reserved. All Borland brand and product names
are trademarks or registered trademarks of Borland Software Corporation. Other brand and product names are
trademarks or registered trademarks of their respective holders.
Printed in the U.S.A.
HDE1350WW21001 1E0R0501
0102030405-9 8 7 6 5 4 3 2 1
D3
Contents
Chapter 1 TPersistent branch. . . . . . . . . . . . . . . 3-14
TComponent branch . . . . . . . . . . . . . 3-15
Introduction 1-1 TControl branch . . . . . . . . . . . . . . . . 3-16
What’s in this manual? . . . . . . . . . . . . . . 1-1
TWinControl/TWidgetControl branch . . . 3-17
Manual conventions . . . . . . . . . . . . . . . . 1-3
Properties common to TControl . . . . . . . 3-18
Developer support services . . . . . . . . . . . . 1-3
Action properties . . . . . . . . . . . . . 3-18
Ordering printed documentation . . . . . . . . 1-3
Position, size, and alignment
Part I properties . . . . . . . . . . . . . . . . . 3-19
Display properties . . . . . . . . . . . . . 3-19
Programming with Delphi Parent properties. . . . . . . . . . . . . . 3-19
A navigation property. . . . . . . . . . . 3-19
Chapter 2 Drag-and-drop properties . . . . . . . . 3-20
Developing applications with Delphi 2-1 Drag-and-dock properties
Integrated development environment . . . . . . 2-1 (VCL only) . . . . . . . . . . . . . . . . 3-20
Designing applications . . . . . . . . . . . . . . 2-2 Standard events common to TControl . . . 3-20
Developing applications . . . . . . . . . . . . . 2-3 Properties common to TWinControl and
Creating projects . . . . . . . . . . . . . . . . 2-3 TWidgetControl . . . . . . . . . . . . . . . 3-21
Editing code. . . . . . . . . . . . . . . . . . . 2-4 General information properties . . . . . 3-21
Compiling applications . . . . . . . . . . . . 2-4 Border style display properties. . . . . . 3-22
Debugging applications . . . . . . . . . . . . 2-5 Navigation properties . . . . . . . . . . . 3-22
Deploying applications . . . . . . . . . . . . 2-5 Drag-and-dock properties
(VCL only) . . . . . . . . . . . . . . . . 3-22
Chapter 3 Events common to TWinControl and
Using the component libraries 3-1 TWidgetControl . . . . . . . . . . . . . . . 3-22
Understanding the component libraries. . . . . 3-1 Creating the application user interface . . . 3-23
Properties, methods, and events . . . . . . . 3-2 Using Delphi components . . . . . . . . . . 3-23
Properties . . . . . . . . . . . . . . . . . . 3-2 Setting component properties . . . . . . . . 3-24
Methods . . . . . . . . . . . . . . . . . . . 3-3 Using the Object Inspector . . . . . . . . 3-24
Events . . . . . . . . . . . . . . . . . . . . 3-3 Using property editors . . . . . . . . . . 3-25
User events . . . . . . . . . . . . . . . . . 3-3 Setting properties at runtime . . . . . . . 3-25
System events . . . . . . . . . . . . . . . . 3-4 Calling methods . . . . . . . . . . . . . . . . 3-25
Object Pascal and the class libraries . . . . . . . 3-4 Working with events and event
Using the object model . . . . . . . . . . . . 3-4 handlers. . . . . . . . . . . . . . . . . . . . 3-25
What is an object?. . . . . . . . . . . . . . 3-5 Generating a new event handler . . . . . 3-26
Examining a Delphi object . . . . . . . . . 3-5 Generating a handler for a component’s
Changing the name of a component . . . 3-7 default event . . . . . . . . . . . . . . . 3-26
Inheriting data and code from an object . . . 3-8 Locating event handlers. . . . . . . . . . 3-26
Scope and qualifiers . . . . . . . . . . . . . . 3-8 Associating an event with an existing
Private, protected, public, and published event handler . . . . . . . . . . . . . . . 3-27
declarations . . . . . . . . . . . . . . . . 3-9 Associating menu events with event
Using object variables . . . . . . . . . . . . . 3-10 handlers . . . . . . . . . . . . . . . . . . 3-28
Creating, instantiating, and destroying Deleting event handlers . . . . . . . . . . 3-28
objects . . . . . . . . . . . . . . . . . . . . . 3-11 VCL and CLX components . . . . . . . . . . . 3-28
Components and ownership . . . . . . . . . 3-11 Adding custom components to the
Objects, components, and controls . . . . . . . . 3-12 Component palette . . . . . . . . . . . . . 3-30
TObject branch . . . . . . . . . . . . . . . . . 3-14 Text controls . . . . . . . . . . . . . . . . . . 3-31
Text control properties. . . . . . . . . . . 3-31

iii
Properties of memo and rich text Using helper objects . . . . . . . . . . . . . . . 3-46
controls . . . . . . . . . . . . . . . . . . . 3-31 Working with lists . . . . . . . . . . . . . . . 3-47
Rich text controls (VCL only) . . . . . . . 3-32 Working with string lists . . . . . . . . . . . 3-47
Specialized input controls . . . . . . . . . . . 3-32 Loading and saving string lists. . . . . . 3-48
Scroll bars . . . . . . . . . . . . . . . . . . 3-32 Creating a new string list . . . . . . . . . 3-48
Track bars . . . . . . . . . . . . . . . . . . 3-33 Manipulating strings in a list . . . . . . . 3-50
Up-down controls (VCL only). . . . . . . 3-33 Associating objects with a string list. . . 3-52
Spin edit controls (CLX only) . . . . . . . 3-33 Windows registry and INI files . . . . . . . 3-52
Hot key controls (VCL only). . . . . . . . 3-33 Using TIniFile (VCL only) . . . . . . . . 3-52
Splitter controls . . . . . . . . . . . . . . . 3-34 Using TRegistry . . . . . . . . . . . . . . 3-53
Buttons and similar controls . . . . . . . . . 3-34 Using TRegIniFile . . . . . . . . . . . . . 3-53
Button controls . . . . . . . . . . . . . . . 3-34 Creating drawing spaces . . . . . . . . . . . 3-54
Bitmap buttons . . . . . . . . . . . . . . . 3-35 Printing . . . . . . . . . . . . . . . . . . . . . 3-54
Speed buttons . . . . . . . . . . . . . . . . 3-35 Using streams . . . . . . . . . . . . . . . . . 3-55
Check boxes . . . . . . . . . . . . . . . . . 3-35
Radio buttons . . . . . . . . . . . . . . . . 3-35 Chapter 4
Toolbars . . . . . . . . . . . . . . . . . . . 3-36 Common programming tasks 4-1
Cool bars (VCL only) . . . . . . . . . . . . 3-36 Understanding classes . . . . . . . . . . . . . . . 4-1
Handling lists . . . . . . . . . . . . . . . . . . 3-36 Defining classes . . . . . . . . . . . . . . . . . . . 4-2
List boxes and check-list boxes . . . . . . 3-37 Handling exceptions . . . . . . . . . . . . . . . . 4-4
Combo boxes . . . . . . . . . . . . . . . . 3-37 Protecting blocks of code . . . . . . . . . . . . 4-4
Tree views . . . . . . . . . . . . . . . . . . 3-38 Responding to exceptions. . . . . . . . . . 4-5
List views . . . . . . . . . . . . . . . . . . 3-38 Exceptions and the flow of control. . . . . 4-6
Date-time pickers and month Nesting exception responses . . . . . . . . 4-6
calendars (VCL only) . . . . . . . . . . . 3-39 Protecting resource allocations. . . . . . . . . 4-7
Grouping components . . . . . . . . . . . . . 3-39 What kind of resources need
Group boxes and radio groups . . . . . . 3-39 protection? . . . . . . . . . . . . . . . . . 4-7
Panels . . . . . . . . . . . . . . . . . . . . 3-39 Creating a resource protection block. . . . 4-8
Scroll boxes . . . . . . . . . . . . . . . . . 3-40 Handling RTL exceptions. . . . . . . . . . . . 4-9
Tab controls . . . . . . . . . . . . . . . . . 3-40 What are RTL exceptions? . . . . . . . . . 4-9
Page controls . . . . . . . . . . . . . . . . 3-40 Creating an exception handler . . . . . . 4-10
Header controls . . . . . . . . . . . . . . . 3-41 Exception handling statements. . . . . . 4-11
Providing visual feedback . . . . . . . . . . . 3-41 Using the exception instance . . . . . . . 4-11
Labels and static text components . . . . 3-41 Scope of exception handlers . . . . . . . 4-12
Status bars . . . . . . . . . . . . . . . . . . 3-42 Providing default exception
Progress bars . . . . . . . . . . . . . . . . 3-42 handlers . . . . . . . . . . . . . . . . . . 4-12
Help and hint properties . . . . . . . . . . 3-42 Handling classes of exceptions . . . . . . 4-13
Grids . . . . . . . . . . . . . . . . . . . . . . . 3-43 Reraising the exception . . . . . . . . . . 4-13
Draw grids. . . . . . . . . . . . . . . . . . 3-43 Handling component exceptions . . . . . . 4-14
String grids . . . . . . . . . . . . . . . . . 3-43 Exception handling with external
Value list editors (VCL only) . . . . . . . . . 3-43 sources . . . . . . . . . . . . . . . . . . . . 4-15
Displaying graphics . . . . . . . . . . . . . . 3-44 Silent exceptions. . . . . . . . . . . . . . . . 4-15
Images . . . . . . . . . . . . . . . . . . . . 3-44 Defining your own exceptions . . . . . . . . 4-16
Shapes . . . . . . . . . . . . . . . . . . . . 3-44 Declaring an exception object type. . . . 4-16
Bevels . . . . . . . . . . . . . . . . . . . . 3-45 Raising an exception. . . . . . . . . . . . 4-17
Paint boxes. . . . . . . . . . . . . . . . . . 3-45 Using interfaces . . . . . . . . . . . . . . . . . . 4-17
Animation control (VCL only). . . . . . . 3-45 Interfaces as a language feature . . . . . . . 4-18
Developing dialog boxes . . . . . . . . . . . 3-45 Implementing interfaces across
Using open dialog boxes . . . . . . . . . . 3-46 the hierarchy . . . . . . . . . . . . . . . 4-18

iv
Using interfaces with procedures . . . . . 4-20 Passing a local variable as a PChar . . . 4-48
Implementing IInterface . . . . . . . . . . . . 4-20 Compiler directives for strings. . . . . . . . 4-49
TInterfacedObject . . . . . . . . . . . . . . . 4-21 Strings and characters: related topics . . . . 4-50
Using the as operator . . . . . . . . . . . . . 4-21 Working with files . . . . . . . . . . . . . . . . 4-50
Reusing code and delegation . . . . . . . . . 4-22 Manipulating files . . . . . . . . . . . . . . . 4-50
Using implements for delegation . . . . . 4-22 Deleting a file. . . . . . . . . . . . . . . . 4-50
Aggregation . . . . . . . . . . . . . . . . . 4-23 Finding a file . . . . . . . . . . . . . . . . 4-51
Memory management of interface Renaming a file. . . . . . . . . . . . . . . 4-52
objects . . . . . . . . . . . . . . . . . . . . . 4-24 File date-time routines . . . . . . . . . . 4-52
Using reference counting . . . . . . . . . 4-24 Copying a file . . . . . . . . . . . . . . . 4-53
Not using reference counting . . . . . . . 4-25 File types with file I/O . . . . . . . . . . . . 4-53
Using interfaces in distributed Using file streams . . . . . . . . . . . . . . . 4-54
applications (VCL only) . . . . . . . . . . . 4-26 Creating and opening files . . . . . . . . 4-54
Defining custom variants . . . . . . . . . . . . . 4-27 Using the file handle . . . . . . . . . . . 4-55
Storing a custom variant type’s data . . . . . 4-28 Reading and writing to files . . . . . . . 4-55
Creating a class to enable the custom Reading and writing strings . . . . . . . 4-56
variant type . . . . . . . . . . . . . . . . . . 4-28 Seeking a file . . . . . . . . . . . . . . . . 4-56
Enabling casting . . . . . . . . . . . . . . 4-29 File position and size . . . . . . . . . . . 4-57
Implementing binary operations . . . . . 4-30 Copying . . . . . . . . . . . . . . . . . . . 4-57
Implementing comparison operations . . 4-32 Converting measurements . . . . . . . . . . . . 4-58
Implementing unary operations . . . . . 4-34 Performing conversions . . . . . . . . . . . 4-58
Copying and clearing custom Performing simple conversions . . . . . 4-58
variants. . . . . . . . . . . . . . . . . . . 4-34 Performing complex conversions . . . . 4-58
Loading and saving custom variant Adding new measurement types . . . . . . 4-59
values. . . . . . . . . . . . . . . . . . . . 4-35 Creating a simple conversion family
Using the TCustomVariantType and adding units . . . . . . . . . . . . . 4-59
descendant . . . . . . . . . . . . . . . . . 4-36 Using a conversion function . . . . . . . 4-60
Writing utilities to work with a custom Using a class to manage
variant type . . . . . . . . . . . . . . . . . . 4-36 conversions . . . . . . . . . . . . . . . . 4-62
Supporting properties and methods in Defining data types . . . . . . . . . . . . . . . . 4-64
custom variants . . . . . . . . . . . . . . . . 4-37
Using TInvokeableVariantType . . . . . . 4-37 Chapter 5
Using TPublishableVariantType. . . . . . 4-39 Building applications, components,
Working with strings . . . . . . . . . . . . . . . 4-39
Character types . . . . . . . . . . . . . . . . . 4-39
and libraries 5-1
Creating applications . . . . . . . . . . . . . . . . 5-1
String types . . . . . . . . . . . . . . . . . . . 4-40
GUI applications. . . . . . . . . . . . . . . . . 5-1
Short strings . . . . . . . . . . . . . . . . . 4-40
User interface models . . . . . . . . . . . . 5-2
Long strings . . . . . . . . . . . . . . . . . 4-41
SDI applications . . . . . . . . . . . . . . . 5-2
WideString. . . . . . . . . . . . . . . . . . 4-41
MDI applications. . . . . . . . . . . . . . . 5-2
PChar types . . . . . . . . . . . . . . . . . 4-42
Setting IDE, project, and compilation
OpenString . . . . . . . . . . . . . . . . . 4-42
options . . . . . . . . . . . . . . . . . . . 5-3
Runtime library string handling routines . . 4-42
Programming templates . . . . . . . . . . . . 5-3
Wide character routines . . . . . . . . . . 4-43
Console applications . . . . . . . . . . . . . . 5-3
Commonly used long string routines. . . 4-43
Service applications . . . . . . . . . . . . . . . 5-4
Declaring and initializing strings . . . . . . . 4-46
Service threads . . . . . . . . . . . . . . . . 5-6
Mixing and converting string types . . . . . 4-47
Service name properties. . . . . . . . . . . 5-7
String to PChar conversions. . . . . . . . . . 4-47
Debugging services . . . . . . . . . . . . . 5-8
String dependencies . . . . . . . . . . . . 4-47
Creating packages and DLLs . . . . . . . . . . . 5-9
Returning a PChar local variable . . . . . 4-48
When to use packages and DLLs . . . . . . . 5-9

v
Writing database applications . . . . . . . . . . 5-10 Registering Help selectors . . . . . . . . 5-27
Distributing database applications . . . . . . 5-11 Using Help in a VCL Application . . . . . . . . 5-28
Creating Web server applications . . . . . . . . 5-11 How TApplication processes VCL
Using Web Broker . . . . . . . . . . . . . . . 5-11 Help . . . . . . . . . . . . . . . . . . . . . . 5-28
Creating WebSnap applications. . . . . . . . 5-13 How VCL controls process Help. . . . . . . 5-28
Using InternetExpress . . . . . . . . . . . . . 5-13 Using Help in a CLX Application . . . . . . . . 5-29
Creating Web Services applications . . . . . 5-13 How TApplication processes CLX
Writing applications using COM. . . . . . . . . 5-14 Help . . . . . . . . . . . . . . . . . . . . . . 5-29
Using COM and DCOM . . . . . . . . . . . . 5-14 How CLX controls process Help. . . . . . . 5-29
Using MTS and COM+ . . . . . . . . . . . . 5-14 Calling a Help system directly . . . . . . . . . 5-30
Using data modules . . . . . . . . . . . . . . . . 5-15 Using IHelpSystem . . . . . . . . . . . . . . . . 5-30
Creating and editing standard data Customizing the IDE Help system . . . . . . . 5-30
modules . . . . . . . . . . . . . . . . . . . . 5-15
Naming a data module and its unit Chapter 6
file. . . . . . . . . . . . . . . . . . . . . . 5-16 Developing the application user
Placing and naming components . . . . . 5-17
Using component properties and
interface 6-1
Controlling application behavior . . . . . . . . . 6-1
events in a data module . . . . . . . . . 5-17
Using the main form . . . . . . . . . . . . . . 6-1
Creating business rules in a data
Adding forms . . . . . . . . . . . . . . . . . . 6-2
module . . . . . . . . . . . . . . . . . . . 5-18
Linking forms . . . . . . . . . . . . . . . . 6-2
Accessing a data module from a form . . . . 5-18
Avoiding circular unit references. . . . . . 6-2
Adding a remote data module to an
Hiding the main form. . . . . . . . . . . . . . 6-3
application server project . . . . . . . . . . 5-19
Working at the application level . . . . . . . . 6-3
Using the Object Repository . . . . . . . . . . . 5-19
Handling the screen . . . . . . . . . . . . . . . 6-3
Sharing items within a project . . . . . . . . 5-19
Managing layout . . . . . . . . . . . . . . . . 6-4
Adding items to the Object Repository . . . 5-19
Responding to event notification . . . . . . . . . 6-5
Sharing objects in a team environment . . . 5-20
Using forms . . . . . . . . . . . . . . . . . . . . . 6-5
Using an Object Repository item in
Controlling when forms reside in
a project . . . . . . . . . . . . . . . . . . . . 5-20
memory . . . . . . . . . . . . . . . . . . . . . 6-6
Copying an item . . . . . . . . . . . . . . 5-20
Displaying an auto-created form. . . . . . 6-6
Inheriting an item. . . . . . . . . . . . . . 5-20
Creating forms dynamically . . . . . . . . 6-6
Using an item . . . . . . . . . . . . . . . . 5-21
Creating modeless forms such as
Using project templates . . . . . . . . . . . . 5-21
windows . . . . . . . . . . . . . . . . . . 6-7
Modifying shared items . . . . . . . . . . . . 5-21
Using a local variable to create a form
Specifying a default project, new form,
instance . . . . . . . . . . . . . . . . . . . 6-7
and main form . . . . . . . . . . . . . . . . 5-21
Passing additional arguments to forms . . . . 6-8
Enabling Help in applications . . . . . . . . . . 5-22
Retrieving data from forms. . . . . . . . . . . 6-9
Help system interfaces . . . . . . . . . . . . . 5-22
Retrieving data from modeless forms . . . 6-9
Implementing ICustomHelpViewer . . . . . 5-23
Retrieving data from modal forms. . . . 6-10
Communicating with the Help
Reusing components and groups of
Manager . . . . . . . . . . . . . . . . . . . . 5-23
components . . . . . . . . . . . . . . . . . . . 6-12
Asking the Help Manager for
Creating and using component templates . . . 6-13
information . . . . . . . . . . . . . . . . . . 5-24
Working with frames . . . . . . . . . . . . . . . 6-13
Displaying keyword-based Help . . . . . . . 5-24
Creating frames . . . . . . . . . . . . . . . . 6-14
Displaying tables of contents . . . . . . . . . 5-25
Adding frames to the component
Implementing IExtendedHelpViewer . . . . 5-26
palette . . . . . . . . . . . . . . . . . . . . . 6-14
Implementing IHelpSelector . . . . . . . . . 5-26
Using and modifying frames. . . . . . . . . 6-14
Registering Help system objects . . . . . . . 5-27
Sharing frames. . . . . . . . . . . . . . . . . 6-15
Registering Help viewers . . . . . . . . . 5-27

vi
Organizing actions for toolbars and Merging menus . . . . . . . . . . . . . . . . 6-40
menus . . . . . . . . . . . . . . . . . . . . . . . 6-16 Specifying the active menu: Menu
What is an action? . . . . . . . . . . . . . . . 6-17 property . . . . . . . . . . . . . . . . . . 6-40
Setting up action bands . . . . . . . . . . . . 6-18 Determining the order of merged menu
Creating toolbars and menus . . . . . . . . . 6-18 items: GroupIndex property . . . . . . 6-40
Adding color, patterns, or pictures to Importing resource files . . . . . . . . . . . 6-41
menus, buttons, and toolbars . . . . . . 6-20 Designing toolbars and cool bars . . . . . . . . 6-41
Adding icons to menus and toolbars . . . 6-21 Adding a toolbar using a panel
Creating toolbars and menus that component . . . . . . . . . . . . . . . . . . 6-42
users can customize. . . . . . . . . . . . 6-21 Adding a speed button to a panel . . . . 6-43
Hiding unused items and categories Assigning a speed button’s glyph . . . . 6-43
in action bands . . . . . . . . . . . . . . 6-22 Setting the initial condition of a
Using action lists . . . . . . . . . . . . . . . . . . 6-23 speed button . . . . . . . . . . . . . . . 6-43
Setting up action lists . . . . . . . . . . . . . 6-23 Creating a group of speed buttons . . . . 6-44
What happens when an action fires . . . . . 6-24 Allowing toggle buttons . . . . . . . . . 6-44
Responding with events . . . . . . . . . . 6-24 Adding a toolbar using the toolbar
How actions find their targets . . . . . . . 6-26 component . . . . . . . . . . . . . . . . . . 6-44
Updating actions . . . . . . . . . . . . . . . . 6-26 Adding a tool button . . . . . . . . . . . 6-45
Predefined action classes . . . . . . . . . . . 6-26 Assigning images to tool buttons . . . . 6-45
Writing action components . . . . . . . . . . 6-27 Setting tool button appearance and
Registering actions . . . . . . . . . . . . . . . 6-28 initial conditions . . . . . . . . . . . . . 6-46
Creating and managing menus. . . . . . . . . . 6-29 Creating groups of tool buttons . . . . . 6-46
Opening the Menu Designer . . . . . . . . . 6-29 Allowing toggled tool buttons . . . . . . 6-46
Building menus . . . . . . . . . . . . . . . . . 6-31 Adding a cool bar component . . . . . . . . 6-47
Naming menus . . . . . . . . . . . . . . . 6-31 Setting the appearance of the
Naming the menu items . . . . . . . . . . 6-31 cool bar . . . . . . . . . . . . . . . . . . 6-47
Adding, inserting, and deleting Responding to clicks . . . . . . . . . . . . . 6-48
menu items . . . . . . . . . . . . . . . . 6-32 Assigning a menu to a tool button . . . . 6-48
Adding separator bars . . . . . . . . . . . 6-32 Adding hidden toolbars . . . . . . . . . . . 6-48
Specifying accelerator keys and Hiding and showing toolbars . . . . . . . . 6-48
keyboard shortcuts . . . . . . . . . . . . 6-33 Demo programs . . . . . . . . . . . . . . . . 6-49
Creating submenus. . . . . . . . . . . . . . . 6-33
Creating submenus by demoting Chapter 7
existing menus . . . . . . . . . . . . . . 6-34 Working with controls 7-1
Moving menu items . . . . . . . . . . . . 6-34 Implementing drag-and-drop in controls . . . . 7-1
Adding images to menu items . . . . . . 6-35 Starting a drag operation . . . . . . . . . . . . 7-1
Viewing the menu . . . . . . . . . . . . . 6-35 Accepting dragged items . . . . . . . . . . . . 7-2
Editing menu items in the Object Dropping items . . . . . . . . . . . . . . . . . 7-2
Inspector . . . . . . . . . . . . . . . . . . . . 6-35 Ending a drag operation . . . . . . . . . . . . 7-3
Using the Menu Designer context Customizing drag and drop with a
menu . . . . . . . . . . . . . . . . . . . . . . 6-36 drag object . . . . . . . . . . . . . . . . . . . 7-3
Commands on the context menu . . . . . 6-36 Changing the drag mouse pointer. . . . . . . 7-4
Switching between menus at design Implementing drag-and-dock in controls . . . . 7-4
time . . . . . . . . . . . . . . . . . . . . . 6-37 Making a windowed control a docking
Using menu templates . . . . . . . . . . . . . 6-37 site. . . . . . . . . . . . . . . . . . . . . . . . 7-4
Saving a menu as a template . . . . . . . . . 6-38 Making a control a dockable child. . . . . . . 7-4
Naming conventions for template Controlling how child controls are
menu items and event handlers . . . . . 6-39 docked . . . . . . . . . . . . . . . . . . . . . 7-5
Manipulating menu items at runtime . . . . 6-40

vii
Controlling how child controls are Making scrollable graphics . . . . . . . . 8-16
undocked . . . . . . . . . . . . . . . . . . . 7-6 Adding an image control . . . . . . . . . 8-17
Controlling how child controls respond Loading and saving graphics files . . . . . . 8-18
to drag-and-dock operations . . . . . . . . 7-6 Loading a picture from a file . . . . . . . 8-19
Working with text in controls. . . . . . . . . . . 7-6 Saving a picture to a file. . . . . . . . . . 8-19
Setting text alignment . . . . . . . . . . . . . 7-7 Replacing the picture . . . . . . . . . . . 8-20
Adding scroll bars at runtime . . . . . . . . . 7-7 Using the clipboard with graphics . . . . . 8-21
Adding the clipboard object. . . . . . . . . . 7-8 Copying graphics to the clipboard. . . . 8-21
Selecting text . . . . . . . . . . . . . . . . . . 7-8 Cutting graphics to the clipboard . . . . 8-21
Selecting all text . . . . . . . . . . . . . . . . 7-9 Pasting graphics from the clipboard . . . 8-22
Cutting, copying, and pasting text . . . . . . 7-9 Rubber banding example . . . . . . . . . . . 8-23
Deleting selected text . . . . . . . . . . . . . 7-9 Responding to the mouse . . . . . . . . . 8-23
Disabling menu items . . . . . . . . . . . . . 7-10 Responding to a mouse-down action . . 8-24
Providing a pop-up menu . . . . . . . . . . . 7-10 Adding a field to a form object to track
Handling the OnPopup event. . . . . . . . . 7-11 mouse actions . . . . . . . . . . . . . . 8-26
Adding graphics to controls . . . . . . . . . . . 7-11 Refining line drawing . . . . . . . . . . . 8-27
Indicating that a control is Working with multimedia . . . . . . . . . . . . 8-28
owner-drawn . . . . . . . . . . . . . . . . . 7-12 Adding silent video clips to an
Adding graphical objects to a string list . . . 7-12 application . . . . . . . . . . . . . . . . . . 8-29
Adding images to an application . . . . . 7-13 Example of adding silent video clips . . 8-30
Adding images to a string list . . . . . . . 7-13 Adding audio and/or video clips to an
Drawing owner-drawn items . . . . . . . 7-13 application . . . . . . . . . . . . . . . . . . 8-30
Sizing owner-draw items . . . . . . . . . . . 7-14 Example of adding audio and/or video
Drawing owner-draw items. . . . . . . . . . 7-15 clips (VCL only) . . . . . . . . . . . . . 8-32

Chapter 8 Chapter 9
Working with graphics and Writing multi-threaded applications 9-1
multimedia 8-1 Defining thread objects . . . . . . . . . . . . . . . 9-1
Overview of graphics programming. . . . . . . 8-1 Initializing the thread . . . . . . . . . . . . . . 9-2
Refreshing the screen . . . . . . . . . . . . . 8-2 Assigning a default priority . . . . . . . . 9-2
Types of graphic objects . . . . . . . . . . . . 8-3 Indicating when threads are freed . . . . . 9-3
Common properties and methods of Writing the thread function . . . . . . . . . . 9-4
Canvas . . . . . . . . . . . . . . . . . . . . . 8-4 Using the main VCL/CLX thread . . . . . 9-4
Using the properties of the Canvas Using thread-local variables . . . . . . . . 9-5
object . . . . . . . . . . . . . . . . . . . . . 8-5 Checking for termination by other
Using pens. . . . . . . . . . . . . . . . . . 8-5 threads . . . . . . . . . . . . . . . . . . . 9-5
Using brushes . . . . . . . . . . . . . . . . 8-8 Handling exceptions in the thread
Reading and setting pixels . . . . . . . . . 8-9 function . . . . . . . . . . . . . . . . . . . 9-6
Using Canvas methods to draw graphic Writing clean-up code. . . . . . . . . . . . . . 9-6
objects . . . . . . . . . . . . . . . . . . . . . 8-9 Coordinating threads . . . . . . . . . . . . . . . . 9-7
Drawing lines and polylines. . . . . . . . 8-10 Avoiding simultaneous access . . . . . . . . . 9-7
Drawing shapes . . . . . . . . . . . . . . . 8-11 Locking objects. . . . . . . . . . . . . . . . 9-7
Handling multiple drawing objects in Using critical sections . . . . . . . . . . . . 9-7
your application . . . . . . . . . . . . . . . 8-12 Using the multi-read exclusive-write
Keeping track of which drawing tool synchronizer . . . . . . . . . . . . . . . . 9-8
to use . . . . . . . . . . . . . . . . . . . . 8-12 Other techniques for sharing memory. . . 9-8
Changing the tool with speed buttons . . 8-13 Waiting for other threads . . . . . . . . . . . . 9-9
Using drawing tools . . . . . . . . . . . . 8-13 Waiting for a thread to finish
Drawing on a graphic . . . . . . . . . . . . . 8-16 executing . . . . . . . . . . . . . . . . . . 9-9

viii
Waiting for a task to be completed . . . . 9-9 Porting Internet applications to Linux . . 10-29
Executing thread objects . . . . . . . . . . . . . 9-10
Overriding the default priority . . . . . . . . 9-11 Chapter 11
Starting and stopping threads . . . . . . . . 9-11 Working with packages and
Debugging multi-threaded applications . . . . 9-12
components 11-1
Why use packages? . . . . . . . . . . . . . . . . 11-2
Chapter 10 Packages and standard DLLs . . . . . . . . 11-2
Using CLX for cross-platform Runtime packages . . . . . . . . . . . . . . . . 11-2
development 10-1 Using packages in an application . . . . . . 11-3
Creating cross-platform applications . . . . . . 10-1 Dynamically loading packages . . . . . . . 11-4
Porting VCL applications to CLX . . . . . . . . 10-2 Deciding which runtime packages
Porting techniques . . . . . . . . . . . . . . . 10-3 to use . . . . . . . . . . . . . . . . . . . . . 11-4
Platform-specific ports . . . . . . . . . . . 10-3 Custom packages . . . . . . . . . . . . . . . 11-4
Cross-platform ports . . . . . . . . . . . . 10-3 Design-time packages . . . . . . . . . . . . . . 11-5
Windows emulation ports . . . . . . . . . 10-3 Installing component packages . . . . . . . 11-5
Porting your application. . . . . . . . . . . . 10-4 Creating and editing packages . . . . . . . . . 11-6
CLX versus VCL . . . . . . . . . . . . . . . . 10-5 Creating a package . . . . . . . . . . . . . . 11-6
What CLX does differently . . . . . . . . . . 10-6 Editing an existing package . . . . . . . . . 11-7
Look and feel . . . . . . . . . . . . . . . . 10-6 Editing package source files manually . . . 11-8
Styles . . . . . . . . . . . . . . . . . . . . . 10-6 Understanding the structure of a
Variants . . . . . . . . . . . . . . . . . . . 10-7 package . . . . . . . . . . . . . . . . . . . . 11-8
Registry . . . . . . . . . . . . . . . . . . . 10-7 Naming packages . . . . . . . . . . . . . 11-8
Other differences . . . . . . . . . . . . . . 10-7 Requires clause. . . . . . . . . . . . . . . 11-8
Missing in CLX . . . . . . . . . . . . . . . . . 10-8 Contains clause. . . . . . . . . . . . . . . 11-9
Features that will not port . . . . . . . . . . . 10-8 Compiling packages . . . . . . . . . . . . .11-10
CLX and VCL unit comparison . . . . . . . . 10-9 Package-specific compiler
Differences in CLX object directives . . . . . . . . . . . . . . . . .11-10
constructors . . . . . . . . . . . . . . . . . 10-13 Using the command-line compiler
Sharing source files between and linker . . . . . . . . . . . . . . . . .11-12
Windows and Linux . . . . . . . . . . . . 10-13 Package files created by a successful
Environmental differences between compilation . . . . . . . . . . . . . . . .11-12
Windows and Linux . . . . . . . . . . . . 10-14 Deploying packages . . . . . . . . . . . . . . .11-13
Directory structure on Linux . . . . . . . . 10-16 Deploying applications that use
Writing portable code . . . . . . . . . . . . 10-17 packages . . . . . . . . . . . . . . . . . . .11-13
Using conditional directives . . . . . . . 10-18 Distributing packages to other
Terminating conditional directives . . . 10-19 developers . . . . . . . . . . . . . . . . . .11-13
Emitting messages . . . . . . . . . . . . 10-20 Package collection files . . . . . . . . . . . .11-13
Including inline assembler code. . . . . 10-20
Messages and system events . . . . . . . . 10-21 Chapter 12
Programming differences on Linux . . . . 10-22 Creating international applications 12-1
Cross-platform database applications . . . . . 10-23 Internationalization and localization . . . . . . 12-1
dbExpress differences . . . . . . . . . . . . 10-23 Internationalization . . . . . . . . . . . . . . 12-1
Component-level differences . . . . . . . . 10-24 Localization . . . . . . . . . . . . . . . . . . 12-2
User interface-level differences . . . . . . . 10-25 Internationalizing applications . . . . . . . . . 12-2
Porting database applications to Enabling application code . . . . . . . . . . 12-2
Linux . . . . . . . . . . . . . . . . . . . . . 10-25 Character sets . . . . . . . . . . . . . . . 12-2
Updating data in dbExpress OEM and ANSI character sets . . . . . . 12-3
applications . . . . . . . . . . . . . . . . . 10-27 Multibyte character sets. . . . . . . . . . 12-3
Cross-platform Internet applications . . . . . 10-29 Wide characters . . . . . . . . . . . . . . 12-4

ix
Including bi-directional functionality Software license requirements. . . . . . . . . 13-14
in applications . . . . . . . . . . . . . . . 12-4 DEPLOY . . . . . . . . . . . . . . . . . . . 13-14
BiDiMode property . . . . . . . . . . . . . 12-6 README . . . . . . . . . . . . . . . . . . . 13-15
Locale-specific features. . . . . . . . . . . 12-8 No-nonsense license agreement . . . . . . 13-15
Designing the user interface. . . . . . . . . . 12-9 Third-party product documentation . . . 13-15
Text . . . . . . . . . . . . . . . . . . . . . . 12-9
Graphic images . . . . . . . . . . . . . . . 12-9 Part II
Formats and sort order . . . . . . . . . . 12-10 Developing database applications
Keyboard mappings . . . . . . . . . . . 12-10
Isolating resources . . . . . . . . . . . . . . 12-10 Chapter 14
Creating resource DLLs . . . . . . . . . . . 12-10
Using resource DLLs . . . . . . . . . . . . . 12-12 Designing database applications 14-1
Dynamic switching of resource DLLs . . . 12-13 Using databases . . . . . . . . . . . . . . . . . . 14-1
Localizing applications . . . . . . . . . . . . . 12-13 Types of databases. . . . . . . . . . . . . . . 14-2
Localizing resources . . . . . . . . . . . . . 12-13 Database security . . . . . . . . . . . . . . . 14-3
Transactions . . . . . . . . . . . . . . . . . . 14-4
Chapter 13 Referential integrity, stored procedures,
and triggers. . . . . . . . . . . . . . . . . . 14-5
Deploying applications 13-1 Database architecture. . . . . . . . . . . . . . . 14-5
Deploying general applications . . . . . . . . . 13-1
General structure . . . . . . . . . . . . . . . 14-6
Using installation programs. . . . . . . . . . 13-2
The user interface form . . . . . . . . . . 14-6
Identifying application files . . . . . . . . 13-2
The data module . . . . . . . . . . . . . . 14-6
Application files. . . . . . . . . . . . . . . 13-3
Connecting directly to a database
Package files . . . . . . . . . . . . . . . . . 13-3
server . . . . . . . . . . . . . . . . . . . . . 14-7
Merge modules . . . . . . . . . . . . . . . 13-3
Using a dedicated file on disk . . . . . . . . 14-9
ActiveX controls . . . . . . . . . . . . . . 13-5
Connecting to another dataset . . . . . . . 14-10
Helper applications. . . . . . . . . . . . . 13-5
Connecting a client dataset to another
DLL locations . . . . . . . . . . . . . . . . 13-5
dataset in the same application. . . . .14-11
Deploying CLX applications . . . . . . . . . . . 13-6
Using a multi-tiered architecture. . . . 14-12
Deploying database applications. . . . . . . . . 13-6
Combining approaches . . . . . . . . . . . 14-14
Deploying dbExpress database
Designing the user interface . . . . . . . . . . 14-15
applications . . . . . . . . . . . . . . . . . . 13-7
Analyzing data . . . . . . . . . . . . . . . 14-15
Deploying BDE applications . . . . . . . . . 13-8
Writing reports. . . . . . . . . . . . . . . . 14-16
Borland Database Engine . . . . . . . . . 13-8
SQL Links . . . . . . . . . . . . . . . . . . 13-8 Chapter 15
Deploying multi-tiered database
applications (DataSnap) . . . . . . . . . . . 13-9 Using data controls 15-1
Deploying Web applications . . . . . . . . . . . 13-9 Using common data control features . . . . . . 15-2
Deployment on Apache . . . . . . . . . . . 13-10 Associating a data control with a
Programming for varying host dataset . . . . . . . . . . . . . . . . . . . . 15-3
environments . . . . . . . . . . . . . . . . . . 13-11 Changing the associated dataset
Screen resolutions and color depths . . . . 13-11 at runtime . . . . . . . . . . . . . . . . . 15-3
Considerations when not Enabling and disabling the data
dynamically resizing . . . . . . . . . . 13-11 source . . . . . . . . . . . . . . . . . . . 15-4
Considerations when dynamically Responding to changes mediated by
resizing forms and controls . . . . . . 13-12 the data source . . . . . . . . . . . . . . 15-4
Accommodating varying color Editing and updating data . . . . . . . . . . 15-5
depths . . . . . . . . . . . . . . . . . . 13-13 Enabling editing in controls on user
Fonts . . . . . . . . . . . . . . . . . . . . . . 13-13 entry . . . . . . . . . . . . . . . . . . . . 15-5
Operating systems versions . . . . . . . . . 13-14 Editing data in a control. . . . . . . . . . 15-5

x
Disabling and enabling data display . . . . . 15-6 Hiding and showing navigator
Refreshing data display . . . . . . . . . . . . 15-6 buttons at runtime . . . . . . . . . . . 15-29
Enabling mouse, keyboard, and timer Displaying fly-over help . . . . . . . . . . 15-30
events . . . . . . . . . . . . . . . . . . . . . 15-7 Using a single navigator for multiple
Choosing how to organize the data . . . . . . . 15-7 datasets . . . . . . . . . . . . . . . . . . . 15-30
Displaying a single record. . . . . . . . . . . 15-7
Displaying data as labels. . . . . . . . . . 15-8 Chapter 16
Displaying and editing fields in an Using decision support
edit box. . . . . . . . . . . . . . . . . . . 15-8
Displaying and editing text in a
components 16-1
Overview . . . . . . . . . . . . . . . . . . . . . 16-1
memo control . . . . . . . . . . . . . . . 15-8
About crosstabs . . . . . . . . . . . . . . . . . . 16-2
Displaying and editing text in a rich
One-dimensional crosstabs. . . . . . . . . . 16-2
edit memo control. . . . . . . . . . . . . 15-9
Multidimensional crosstabs . . . . . . . . . 16-3
Displaying and editing graphics
Guidelines for using decision support
fields in an image control . . . . . . . . 15-9
components . . . . . . . . . . . . . . . . . . . 16-3
Displaying and editing data in list
Using datasets with decision support
and combo boxes . . . . . . . . . . . . 15-10
components . . . . . . . . . . . . . . . . . . . 16-4
Handling Boolean field values with
Creating decision datasets with TQuery
check boxes . . . . . . . . . . . . . . . 15-12
or TTable . . . . . . . . . . . . . . . . . . . 16-5
Restricting field values with radio
Creating decision datasets with the
controls . . . . . . . . . . . . . . . . . . 15-13
Decision Query editor. . . . . . . . . . . . 16-6
Displaying multiple records. . . . . . . . . 15-14
Using decision cubes . . . . . . . . . . . . . . . 16-7
Viewing and editing data with TDBGrid . . . 15-15
Decision cube properties and events . . . . 16-7
Using a grid control in its default
Using the Decision Cube editor . . . . . . . 16-7
state . . . . . . . . . . . . . . . . . . . . . 15-15
Viewing and changing dimension
Creating a customized grid . . . . . . . . . 15-16
settings . . . . . . . . . . . . . . . . . . 16-8
Understanding persistent columns . . . 15-16
Setting the maximum available
Creating persistent columns . . . . . . . 15-17
dimensions and summaries. . . . . . . 16-8
Deleting persistent columns . . . . . . . 15-18
Viewing and changing design
Arranging the order of persistent
options . . . . . . . . . . . . . . . . . . 16-8
columns . . . . . . . . . . . . . . . . . 15-19
Using decision sources . . . . . . . . . . . . . . 16-9
Setting column properties at design
Properties and events . . . . . . . . . . . . . 16-9
time . . . . . . . . . . . . . . . . . . . . 15-19
Using decision pivots. . . . . . . . . . . . . . . 16-9
Defining a lookup list column . . . . . . 15-20
Decision pivot properties. . . . . . . . . . 16-10
Putting a button in a column . . . . . . 15-21
Creating and using decision grids . . . . . . 16-10
Restoring default values to a
Creating decision grids . . . . . . . . . . . 16-10
column . . . . . . . . . . . . . . . . . . 15-21
Using decision grids . . . . . . . . . . . . .16-11
Displaying ADT and array fields . . . . . . 15-21
Opening and closing decision grid
Setting grid options . . . . . . . . . . . . . 15-23
fields. . . . . . . . . . . . . . . . . . . .16-11
Editing in the grid . . . . . . . . . . . . . . 15-25
Reorganizing rows and columns in
Controlling grid drawing . . . . . . . . . . 15-25
decision grids. . . . . . . . . . . . . . .16-11
Responding to user actions at runtime. . . 15-25
Drilling down for detail in
Creating a grid that contains other
decision grids. . . . . . . . . . . . . . .16-11
data-aware controls . . . . . . . . . . . . . . 15-26
Limiting dimension selection in
Navigating and manipulating records. . . . . 15-28
decision grids. . . . . . . . . . . . . . 16-12
Choosing navigator buttons to
Decision grid properties . . . . . . . . . . 16-12
display . . . . . . . . . . . . . . . . . . . . 15-28
Creating and using decision graphs . . . . . 16-13
Hiding and showing navigator
Creating decision graphs . . . . . . . . . . 16-13
buttons at design time . . . . . . . . . 15-29
Using decision graphs . . . . . . . . . . . 16-13

xi
The decision graph display . . . . . . . . . 16-15 Opening and closing datasets . . . . . . . . . . 18-4
Customizing decision graphs . . . . . . . . 16-15 Navigating datasets. . . . . . . . . . . . . . . . 18-5
Setting decision graph template Using the First and Last methods . . . . . . 18-6
defaults. . . . . . . . . . . . . . . . . . 16-16 Using the Next and Prior methods . . . . . 18-6
Customizing decision graph Using the MoveBy method . . . . . . . . . . 18-7
series . . . . . . . . . . . . . . . . . . . 16-17 Using the Eof and Bof properties . . . . . . 18-7
Decision support components at Eof . . . . . . . . . . . . . . . . . . . . . . 18-7
runtime . . . . . . . . . . . . . . . . . . . . . 16-18 Bof . . . . . . . . . . . . . . . . . . . . . . 18-8
Decision pivots at runtime . . . . . . . . . 16-18 Marking and returning to records . . . . . . 18-9
Decision grids at runtime . . . . . . . . . . 16-18 The Bookmark property. . . . . . . . . . 18-9
Decision graphs at runtime . . . . . . . . . 16-19 The GetBookmark method . . . . . . . . 18-9
Decision support components and The GotoBookmark and Bookmark
memory control . . . . . . . . . . . . . . . . 16-19 Valid methods . . . . . . . . . . . . . . 18-9
Setting maximum dimensions, The CompareBookmarks method . . . . 18-9
summaries, and cells . . . . . . . . . . . . 16-19 The FreeBookmark method . . . . . . . . 18-9
Setting dimension state . . . . . . . . . . . 16-19 A bookmarking example . . . . . . . . 18-10
Using paged dimensions . . . . . . . . . . 16-20 Searching datasets . . . . . . . . . . . . . . . 18-10
Using Locate . . . . . . . . . . . . . . . . . 18-10
Chapter 17 Using Lookup . . . . . . . . . . . . . . . . .18-11
Connecting to databases 17-1 Displaying and editing a subset of data
Using implicit connections . . . . . . . . . . . . 17-2 using filters . . . . . . . . . . . . . . . . . . 18-12
Controlling connections . . . . . . . . . . . . . . 17-2 Enabling and disabling filtering . . . . . . 18-12
Connecting to a database server . . . . . . . 17-3 Creating filters . . . . . . . . . . . . . . . . 18-13
Disconnecting from a database server . . . . 17-3 Setting the Filter property. . . . . . . . 18-13
Controlling server login . . . . . . . . . . . . . . 17-4 Writing an OnFilterRecord event
Managing transactions . . . . . . . . . . . . . . 17-5 handler . . . . . . . . . . . . . . . . . 18-14
Starting a transaction . . . . . . . . . . . . . 17-6 Switching filter event handlers at
Ending a transaction . . . . . . . . . . . . . . 17-7 runtime . . . . . . . . . . . . . . . . . 18-15
Ending a successful transaction . . . . . . 17-8 Setting filter options. . . . . . . . . . . . . 18-15
Ending an unsuccessful transaction . . . 17-8 Navigating records in a filtered
Specifying the transaction isolation dataset . . . . . . . . . . . . . . . . . . . 18-16
level . . . . . . . . . . . . . . . . . . . . . . 17-9 Modifying data . . . . . . . . . . . . . . . . . 18-16
Sending commands to the server . . . . . . . 17-10 Editing records. . . . . . . . . . . . . . . . 18-17
Working with associated datasets . . . . . . . 17-11 Adding new records . . . . . . . . . . . . 18-18
Closing all datasets without dis- Inserting records . . . . . . . . . . . . . 18-19
connecting from the server . . . . . . . . 17-12 Appending records . . . . . . . . . . . 18-19
Iterating through the associated Deleting records . . . . . . . . . . . . . . . 18-19
datasets . . . . . . . . . . . . . . . . . . . 17-12 Posting data . . . . . . . . . . . . . . . . . 18-20
Obtaining metadata . . . . . . . . . . . . . . . 17-12 Canceling changes. . . . . . . . . . . . . . 18-20
Listing available tables. . . . . . . . . . . . 17-13 Modifying entire records . . . . . . . . . . 18-21
Listing the fields in a table . . . . . . . . . 17-13 Calculating fields . . . . . . . . . . . . . . . . 18-22
Listing available stored procedures . . . . 17-13 Types of datasets . . . . . . . . . . . . . . . . 18-23
Listing available indexes . . . . . . . . . . 17-14 Using table-type datasets . . . . . . . . . . . 18-24
Listing stored procedure parameters. . . . 17-14 Advantages of using table-type
datasets . . . . . . . . . . . . . . . . . . . 18-25
Chapter 18 Sorting records with indexes . . . . . . . . 18-25
Understanding datasets 18-1 Obtaining information about
Using TDataSet descendants . . . . . . . . . . . 18-2 indexes . . . . . . . . . . . . . . . . . 18-26
Determining dataset states . . . . . . . . . . . . 18-3

xii
Specifying an index with Setting up parameters at design
IndexName . . . . . . . . . . . . . . . 18-26 time . . . . . . . . . . . . . . . . . . . 18-50
Creating an index with Index Using parameters at runtime . . . . . . 18-52
FieldNames . . . . . . . . . . . . . . . 18-27 Preparing stored procedures . . . . . . . . 18-52
Using Indexes to search for records . . . . 18-27 Executing stored procedures that don’t
Executing a search with Goto return a result set . . . . . . . . . . . . . 18-53
methods . . . . . . . . . . . . . . . . . 18-28 Fetching multiple result sets . . . . . . . . 18-53
Executing a search with Find
methods . . . . . . . . . . . . . . . . . 18-28 Chapter 19
Specifying the current record after a Working with field components 19-1
successful search . . . . . . . . . . . . 18-29 Dynamic field components . . . . . . . . . . . 19-2
Searching on partial keys . . . . . . . . 18-29 Persistent field components . . . . . . . . . . . 19-3
Repeating or extending a search . . . . 18-29 Creating persistent fields . . . . . . . . . . . 19-4
Limiting records with ranges . . . . . . . . 18-30 Arranging persistent fields . . . . . . . . . . 19-5
Understanding the differences between Defining new persistent fields . . . . . . . . 19-5
ranges and filters . . . . . . . . . . . . 18-30 Defining a data field . . . . . . . . . . . . 19-6
Specifying Ranges . . . . . . . . . . . . 18-30 Defining a calculated field . . . . . . . . 19-7
Modifying a range . . . . . . . . . . . . 18-33 Programming a calculated field . . . . . 19-7
Applying or canceling a range . . . . . 18-33 Defining a lookup field . . . . . . . . . . 19-8
Creating master/detail relationships. . . . 18-34 Defining an aggregate field . . . . . . . 19-10
Making the table a detail of another Deleting persistent field components . . . 19-10
dataset . . . . . . . . . . . . . . . . . . 18-34 Setting persistent field properties
Using nested detail tables . . . . . . . . 18-36 and events . . . . . . . . . . . . . . . . . 19-10
Controlling Read/write access to Setting display and edit properties
tables . . . . . . . . . . . . . . . . . . . . . 18-37 at design time. . . . . . . . . . . . . . .19-11
Creating and deleting tables . . . . . . . . 18-37 Setting field component properties
Creating tables . . . . . . . . . . . . . . 18-37 at runtime . . . . . . . . . . . . . . . . 19-12
Deleting tables . . . . . . . . . . . . . . 18-40 Creating attribute sets for field
Emptying tables . . . . . . . . . . . . . . . 18-40 components . . . . . . . . . . . . . . . 19-12
Synchronizing tables . . . . . . . . . . . . . 18-40 Associating attribute sets with field
Using query-type datasets . . . . . . . . . . . 18-41 components . . . . . . . . . . . . . . . 19-13
Specifying the query . . . . . . . . . . . . . 18-42 Removing attribute associations . . . . 19-14
Specifying a query using the SQL Controlling and masking user
property . . . . . . . . . . . . . . . . . 18-42 input . . . . . . . . . . . . . . . . . . . 19-14
Specifying a query using the Using default formatting for numeric,
CommandText property . . . . . . . . 18-43 date, and time fields . . . . . . . . . . 19-14
Using parameters in queries . . . . . . . . 18-43 Handling events . . . . . . . . . . . . . 19-15
Supplying parameters at design Working with field component methods
time . . . . . . . . . . . . . . . . . . . . 18-44 at runtime . . . . . . . . . . . . . . . . . . . 19-16
Supplying parameters at runtime . . . . 18-45 Displaying, converting, and accessing
Establishing master/detail relationships field values. . . . . . . . . . . . . . . . . . . 19-17
using parameters . . . . . . . . . . . . . . 18-46 Displaying field component values in
Preparing queries. . . . . . . . . . . . . . . 18-47 standard controls . . . . . . . . . . . . . 19-17
Executing queries that don’t return a Converting field values . . . . . . . . . . . 19-17
result set . . . . . . . . . . . . . . . . . . . 18-47 Accessing field values with the default
Using unidirectional result sets . . . . . . . 18-48 dataset property . . . . . . . . . . . . . . 19-19
Using stored procedure-type datasets . . . . . 18-48 Accessing field values with a dataset’s
Working with stored procedure Fields property. . . . . . . . . . . . . . . 19-19
parameters. . . . . . . . . . . . . . . . . . 18-50

xiii
Accessing field values with a dataset’s Creating heterogeneous queries . . . . . 20-9
FieldByName method . . . . . . . . . . . 19-20 Obtaining an editable result set . . . . 20-10
Setting a default value for a field. . . . . . . . 19-20 Updating read-only result sets . . . . . .20-11
Working with constraints . . . . . . . . . . . . 19-21 Using TStoredProc . . . . . . . . . . . . . .20-11
Creating a custom constraint . . . . . . . . 19-21 Binding parameters . . . . . . . . . . . 20-12
Using server constraints . . . . . . . . . . . 19-21 Working with Oracle overloaded
Using object fields . . . . . . . . . . . . . . . . 19-22 stored procedures . . . . . . . . . . . 20-12
Displaying ADT and array fields . . . . . . 19-23 Connecting to databases with
Working with ADT fields . . . . . . . . . . 19-23 TDatabase . . . . . . . . . . . . . . . . . 20-12
Using persistent field components . . . 19-24 Associating a database component
Using the dataset’s FieldByName with a session. . . . . . . . . . . . . . 20-13
method . . . . . . . . . . . . . . . . . . 19-24 Understanding database and session
Using the dateset’s FieldValues component interactions . . . . . . . . 20-13
property . . . . . . . . . . . . . . . . . 19-24 Identifying the database . . . . . . . . 20-13
Using the ADT field’s FieldValues Opening a connection using
property . . . . . . . . . . . . . . . . . 19-24 TDatabase . . . . . . . . . . . . . . . . 20-15
Using the ADT field’s Fields Using database components in
property . . . . . . . . . . . . . . . . . 19-25 data modules . . . . . . . . . . . . . . 20-16
Working with array fields . . . . . . . . . . 19-25 Managing database sessions . . . . . . . . 20-16
Using persistent fields . . . . . . . . . . 19-25 Activating a session . . . . . . . . . . . 20-17
Using the array field’s FieldValues Specifying default database
property . . . . . . . . . . . . . . . . . 19-25 connection behavior . . . . . . . . . . 20-18
Using the array field’s Fields Managing database connections . . . . 20-19
property . . . . . . . . . . . . . . . . . 19-26 Working with password-protected
Working with dataset fields . . . . . . . . . 19-26 Paradox and dBASE tables . . . . . . 20-21
Displaying dataset fields . . . . . . . . . 19-26 Specifying Paradox directory
Accessing data in a nested dataset . . . 19-26 locations. . . . . . . . . . . . . . . . . 20-24
Working with reference fields . . . . . . . . 19-27 Working with BDE aliases . . . . . . . 20-24
Displaying reference fields. . . . . . . . 19-27 Retrieving information about a
Accessing data in a reference field . . . 19-27 session . . . . . . . . . . . . . . . . . . 20-26
Creating additional sessions . . . . . . 20-27
Chapter 20 Naming a session . . . . . . . . . . . . 20-28
Using the Borland Database Managing multiple sessions . . . . . . 20-28
Using transactions with the BDE . . . . . . . 20-30
Engine 20-1 Using passthrough SQL . . . . . . . . . . 20-30
BDE-based architecture . . . . . . . . . . . . . . 20-1
Using local transactions . . . . . . . . . . 20-31
Using BDE-enabled datasets . . . . . . . . . 20-2
Using the BDE to cache updates . . . . . . . 20-32
Associating a dataset with database
Enabling BDE-based cached updates . . . 20-33
and session connections . . . . . . . . . 20-3
Applying BDE-based cached updates. . . 20-33
Caching BLOBs . . . . . . . . . . . . . . . 20-4
Applying cached updates using
Obtaining a BDE handle . . . . . . . . . . 20-4
a database . . . . . . . . . . . . . . . . 20-35
Using TTable . . . . . . . . . . . . . . . . . . 20-4
Applying cached updates with dataset
Specifying the table type for local
component methods . . . . . . . . . . 20-35
tables . . . . . . . . . . . . . . . . . . . . 20-5
Creating an OnUpdateRecord
Controlling read/write access to
event handler . . . . . . . . . . . . . . 20-36
local tables . . . . . . . . . . . . . . . . . 20-6
Handling cached update errors . . . . 20-37
Specifying a dBASE index file . . . . . . . 20-6
Using update objects to update a
Renaming local tables . . . . . . . . . . . 20-7
dataset . . . . . . . . . . . . . . . . . . . 20-39
Importing data from another table . . . . 20-8
Using TQuery. . . . . . . . . . . . . . . . . . 20-8

xiv
Creating SQL statements for update Loading data from and saving
components . . . . . . . . . . . . . . . 20-40 data to files . . . . . . . . . . . . . . . 21-14
Using multiple update objects. . . . . . 20-43 Using TADODataSet . . . . . . . . . . . . 21-15
Executing the SQL statements . . . . . . 20-44 Using Command objects . . . . . . . . . . . . 21-16
Using TBatchMove. . . . . . . . . . . . . . . . 20-47 Specifying the command . . . . . . . . . . 21-17
Creating a batch move component . . . . . 20-47 Using the Execute method . . . . . . . . . 21-17
Specifying a batch move mode . . . . . . . 20-49 Canceling commands . . . . . . . . . . . . 21-18
Appending records . . . . . . . . . . . . 20-49 Retrieving result sets with commands . . 21-18
Updating records . . . . . . . . . . . . . 20-49 Handling command parameters . . . . . . 21-19
Appending and updating
records . . . . . . . . . . . . . . . . . . 20-49 Chapter 22
Copying datasets . . . . . . . . . . . . . 20-49 Using unidirectional datasets 22-1
Deleting records. . . . . . . . . . . . . . 20-50 Types of unidirectional datasets . . . . . . . . . 22-2
Mapping data types . . . . . . . . . . . . . 20-50 Connecting to the database server . . . . . . . 22-2
Executing a batch move . . . . . . . . . . . 20-51 Setting up TSQLConnection . . . . . . . . . 22-3
Handling batch move errors . . . . . . . . 20-51 Identifying the driver . . . . . . . . . . . 22-3
The Data Dictionary . . . . . . . . . . . . . . . 20-52 Specifying connection parameters . . . . 22-4
Tools for working with the BDE . . . . . . . . 20-53 Naming a connection description . . . . 22-4
Using the Connection Editor . . . . . . . 22-5
Chapter 21 Specifying what data to display . . . . . . . . . 22-5
Working with ADO components 21-1 Representing the results of a query . . . . . 22-6
Overview of ADO components . . . . . . . . . 21-1 Representing the records in a table . . . . . 22-6
Connecting to ADO data stores . . . . . . . . . 21-2 Representing a table using
Connecting to a data store using TSQLDataSet . . . . . . . . . . . . . . . 22-6
TADOConnection. . . . . . . . . . . . . . . 21-3 Representing a table using
Accessing the connection object . . . . . . 21-4 TSQLTable. . . . . . . . . . . . . . . . . 22-7
Fine-tuning a connection . . . . . . . . . . . 21-4 Representing the results of a stored
Forcing asynchronous connections . . . . 21-5 procedure . . . . . . . . . . . . . . . . . . . 22-7
Controlling timeouts . . . . . . . . . . . . 21-5 Fetching the data . . . . . . . . . . . . . . . . . 22-8
Indicating the types of operations the Preparing the dataset . . . . . . . . . . . . . 22-8
connection supports . . . . . . . . . . . 21-6 Fetching multiple datasets . . . . . . . . . . 22-9
Specifying whether the connection Executing commands that do not return
automatically initiates transactions . . . 21-6 records . . . . . . . . . . . . . . . . . . . . . . 22-9
Accessing the connection’s commands . . . 21-7 Specifying the command to execute. . . . . 22-9
ADO connection events . . . . . . . . . . . . 21-7 Executing the command . . . . . . . . . . 22-10
Events when establishing a Creating and modifying server metadata. 22-10
connection . . . . . . . . . . . . . . . . . 21-7 Setting up master/detail linked cursors . . . 22-12
Events when disconnecting . . . . . . . . 21-8 Accessing schema information . . . . . . . . 22-12
Events when managing transactions . . . 21-8 Fetching metadata into a unidirectional
Other events . . . . . . . . . . . . . . . . . 21-8 dataset . . . . . . . . . . . . . . . . . . . 22-12
Using ADO datasets . . . . . . . . . . . . . . . . 21-9 Fetching data after using the dataset
Connecting an ADO dataset to a for metadata . . . . . . . . . . . . . . 22-13
data store . . . . . . . . . . . . . . . . . 21-9 The structure of metadata datasets . . 22-13
Working with record sets . . . . . . . . 21-10 Debugging dbExpress applications . . . . . . 22-17
Filtering records based on Using TSQLMonitor to monitor SQL
bookmarks . . . . . . . . . . . . . . . . 21-10 commands . . . . . . . . . . . . . . . . . 22-17
Fetching records asynchronously . . . . 21-11 Using a callback to monitor SQL
Using batch updates . . . . . . . . . . . 21-12 commands . . . . . . . . . . . . . . . . . 22-18

xv
Chapter 23 Handling constraints from the server . . . 23-28
Refreshing records. . . . . . . . . . . . . . 23-29
Using client datasets 23-1 Communicating with providers using
Working with data using a client dataset . . . . 23-2
custom events . . . . . . . . . . . . . . . 23-30
Navigating data in client datasets . . . . . . 23-2
Overriding the source dataset . . . . . . . 23-31
Limiting what records appear. . . . . . . . . 23-2
Using a client dataset with file-based data . . 23-31
Editing data . . . . . . . . . . . . . . . . . . . 23-5
Creating a new dataset . . . . . . . . . . . 23-32
Undoing changes . . . . . . . . . . . . . . 23-5
Loading data from a file or stream . . . . 23-32
Saving changes . . . . . . . . . . . . . . . 23-6
Merging changes into data . . . . . . . . . 23-33
Constraining data values . . . . . . . . . . . 23-6
Saving data to a file or stream . . . . . . . 23-33
Specifying custom constraints. . . . . . . 23-7
Sorting and indexing. . . . . . . . . . . . . . 23-7
Adding a new index . . . . . . . . . . . . 23-8
Chapter 24
Deleting and switching indexes . . . . . . 23-9 Using provider components 24-1
Using indexes to group data. . . . . . . . 23-9 Determining the source of data . . . . . . . . . 24-2
Representing calculated values . . . . . . . 23-10 Using a dataset as the source of the
Using internally calculated fields in data . . . . . . . . . . . . . . . . . . . . . . 24-2
client datasets . . . . . . . . . . . . . . 23-10 Using an XML document as the source
Using maintained aggregates . . . . . . . . 23-11 of the data . . . . . . . . . . . . . . . . . . 24-2
Specifying aggregates . . . . . . . . . . 23-11 Communicating with the client dataset . . . . 24-3
Aggregating over groups of Choosing how to apply updates using a
records . . . . . . . . . . . . . . . . . . 23-12 dataset provider . . . . . . . . . . . . . . . . . 24-4
Obtaining aggregate values . . . . . . . 23-13 Controlling what information is included
Copying data from another dataset . . . . 23-13 in data packets. . . . . . . . . . . . . . . . . . 24-4
Assigning data directly. . . . . . . . . . 23-13 Specifying what fields appear in
Cloning a client dataset cursor . . . . . 23-14 data packets . . . . . . . . . . . . . . . . . 24-4
Adding application-specific information Setting options that influence the
to the data . . . . . . . . . . . . . . . . . . 23-14 data packets . . . . . . . . . . . . . . . . . 24-5
Using a client dataset to cache updates . . . . 23-15 Adding custom information to
Overview of using cached updates. . . . . 23-16 data packets . . . . . . . . . . . . . . . . . 24-6
Choosing the type of dataset for caching Responding to client data requests . . . . . . . 24-7
updates . . . . . . . . . . . . . . . . . . . 23-17 Responding to client update requests . . . . . 24-8
Indicating what records are modified . . . 23-18 Editing delta packets before updating the
Updating records . . . . . . . . . . . . . . . 23-19 database . . . . . . . . . . . . . . . . . . . 24-9
Applying updates. . . . . . . . . . . . . 23-19 Influencing how updates are applied . . . . 24-9
Intervening as updates are applied . . . 23-20 Screening individual updates . . . . . . . .24-11
Reconciling update errors . . . . . . . . 23-22 Resolving update errors on the
Using a client dataset with a provider . . . . . 23-23 provider. . . . . . . . . . . . . . . . . . . .24-11
Specifying a provider . . . . . . . . . . . . 23-24 Applying updates to datasets that do
Requesting data from the source dataset not represent a single table . . . . . . . . .24-11
or document. . . . . . . . . . . . . . . . . 23-25 Responding to client-generated events . . . . 24-12
Incremental fetching . . . . . . . . . . . 23-25 Handling server constraints . . . . . . . . . . 24-12
Fetch-on-demand . . . . . . . . . . . . . 23-26
Getting parameters from the source Chapter 25
dataset . . . . . . . . . . . . . . . . . . . . 23-26 Creating multi-tiered applications 25-1
Passing parameters to the source Advantages of the multi-tiered database
dataset . . . . . . . . . . . . . . . . . . . . 23-27 model . . . . . . . . . . . . . . . . . . . . . . . 25-2
Sending query or stored procedure Understanding provider-based multi-tiered
parameters . . . . . . . . . . . . . . . . 23-27 applications . . . . . . . . . . . . . . . . . . . 25-2
Limiting records with parameters . . . 23-28 Overview of a three-tiered application . . . 25-3

xvi
The structure of the client application . . . . 25-4 Dropping or changing a server
The structure of the application server. . . . 25-5 connection . . . . . . . . . . . . . . . 25-28
The contents of the remote data Calling server interfaces . . . . . . . . . . 25-29
module . . . . . . . . . . . . . . . . . . . 25-6 Connecting to an application server
Using transactional data modules . . . . 25-6 that uses multiple data modules . . . . . 25-30
Pooling remote data modules . . . . . . . 25-8 Writing Web-based client applications . . . . 25-31
Choosing a connection protocol . . . . . . . 25-8 Distributing a client application as
Using DCOM connections . . . . . . . . . 25-8 an ActiveX control . . . . . . . . . . . . . 25-32
Using Socket connections . . . . . . . . . 25-9 Creating an Active Form for the client
Using Web connections. . . . . . . . . . . 25-9 application . . . . . . . . . . . . . . . 25-33
Using SOAP connections. . . . . . . . . 25-10 Building Web applications using
Using CORBA connections . . . . . . . 25-10 InternetExpress . . . . . . . . . . . . . . 25-33
Building a multi-tiered application . . . . . . 25-11 Building an InternetExpress
Creating the application server. . . . . . . . . 25-11 application . . . . . . . . . . . . . . . . . 25-34
Setting up the remote data module. . . . . 25-13 Using the javascript libraries . . . . . . 25-35
Configuring TRemoteData- Granting permission to access and
Module . . . . . . . . . . . . . . . . . . 25-13 launch the application server . . . . . 25-36
Configuring TMTSDataModule . . . . . 25-14 Using an XML broker . . . . . . . . . . . . 25-36
Configuring TSoapDataModule. . . . . 25-15 Fetching XML data packets . . . . . . . 25-36
Configuring TCorbaDataModule . . . . 25-15 Applying updates from XML delta
Extending the application server’s packets . . . . . . . . . . . . . . . . . 25-37
interface . . . . . . . . . . . . . . . . . . . 25-16 Creating Web pages with an InternetExpress
Adding callbacks to the application page producer . . . . . . . . . . . . . . . 25-38
server’s interface . . . . . . . . . . . . 25-17 Using the Web page editor . . . . . . . 25-39
Extending a transactional application Setting Web item properties . . . . . . 25-40
server’s interface . . . . . . . . . . . . 25-18 Customizing the InternetExpress page
Managing transactions in multi-tiered producer template . . . . . . . . . . . 25-41
applications . . . . . . . . . . . . . . . . . 25-18
Supporting master/detail Chapter 26
relationships. . . . . . . . . . . . . . . . . 25-19 Using XML in database
Supporting state information in remote
data modules . . . . . . . . . . . . . . . . 25-19
applications 26-1
Defining transformations . . . . . . . . . . . . 26-1
Using multiple remote data modules . . . 25-21
Mapping between XML nodes and data
Registering the application server . . . . . . . 25-22
packet fields . . . . . . . . . . . . . . . . . 26-2
Creating the client application . . . . . . . . . 25-23
Using XMLMapper . . . . . . . . . . . . . . 26-4
Connecting to the application server. . . . 25-23
Loading an XML schema or data
Specifying a connection using
packet . . . . . . . . . . . . . . . . . . . 26-4
DCOM . . . . . . . . . . . . . . . . . . 25-24
Defining mappings . . . . . . . . . . . . 26-4
Specifying a connection using
Generating transformation files . . . . . 26-5
sockets . . . . . . . . . . . . . . . . . . 25-25
Converting XML documents into data
Specifying a connection using
packets . . . . . . . . . . . . . . . . . . . . . . 26-6
HTTP . . . . . . . . . . . . . . . . . . . 25-26
Specifying the source XML document . . . 26-6
Specifying a connection using
Specifying the transformation . . . . . . . . 26-7
SOAP . . . . . . . . . . . . . . . . . . . 25-26
Obtaining the resulting data packet . . . . . 26-7
Specifying a connection using
Converting user-defined nodes . . . . . . . 26-7
CORBA . . . . . . . . . . . . . . . . . . 25-27
Using an XML document as the source for a
Brokering connections . . . . . . . . . . 25-27
provider . . . . . . . . . . . . . . . . . . . . . 26-8
Managing server connections . . . . . . . . 25-28
Using an XML document as the client of
Connecting to the server . . . . . . . . . 25-28
a provider . . . . . . . . . . . . . . . . . . . . 26-9

xvii
Fetching an XML document from The request method type . . . . . . . . . 28-6
a provider . . . . . . . . . . . . . . . . . . . 26-9 Enabling and disabling action items. . . 28-6
Applying updates from an XML Choosing a default action item . . . . . . 28-7
document to a provider . . . . . . . . . . 26-10 Responding to request messages with
action items. . . . . . . . . . . . . . . . . . 28-7
Part III Sending the response . . . . . . . . . . . 28-8
Writing Internet applications Using multiple action items . . . . . . . 28-8
Accessing client request information . . . . . . 28-8
Chapter 27 Properties that contain request header
information. . . . . . . . . . . . . . . . . . 28-9
Creating Internet applications 27-1 Properties that identify the target . . . . 28-9
About Web Broker and WebSnap . . . . . . . . 27-1 Properties that describe the Web
Terminology and standards. . . . . . . . . . . . 27-2 client . . . . . . . . . . . . . . . . . . . . 28-9
Parts of a Uniform Resource Locator. . . . . 27-3 Properties that identify the purpose
URI vs. URL . . . . . . . . . . . . . . . . . 27-3 of the request . . . . . . . . . . . . . . . 28-9
HTTP request header information . . . . . . 27-4 Properties that describe the expected
HTTP server activity. . . . . . . . . . . . . . . . 27-4 response . . . . . . . . . . . . . . . . . 28-10
Composing client requests . . . . . . . . . . 27-4 Properties that describe the
Serving client requests . . . . . . . . . . . . . 27-5 content. . . . . . . . . . . . . . . . . . 28-10
Responding to client requests . . . . . . . . . 27-5 The content of HTTP request
Types of Web server applications . . . . . . . . 27-6 messages . . . . . . . . . . . . . . . . . . 28-10
ISAPI and NSAPI . . . . . . . . . . . . . . 27-6 Creating HTTP response messages . . . . . . 28-10
Apache . . . . . . . . . . . . . . . . . . . . 27-6 Filling in the response header . . . . . . . .28-11
CGI stand-alone. . . . . . . . . . . . . . . 27-6 Indicating the response status . . . . . .28-11
Win-CGI stand-alone . . . . . . . . . . . . 27-7 Indicating the need for client
Debugging server applications . . . . . . . . . . 27-7 action . . . . . . . . . . . . . . . . . . .28-11
Using the Web Application Debugger . . . . 27-7 Describing the server application . . . 28-12
Launching your application with the Describing the content . . . . . . . . . 28-12
Web Application Debugger . . . . . . . 27-7 Setting the response content . . . . . . . . 28-12
Converting your application to another Sending the response . . . . . . . . . . . . 28-12
type of Web server application . . . . . 27-8 Generating the content of response
Debugging Web applications that are messages . . . . . . . . . . . . . . . . . . . . 28-13
DLLs . . . . . . . . . . . . . . . . . . . . . . 27-8 Using page producer components. . . . . 28-13
Debugging under Windows NT. . . . . . 27-9 HTML templates . . . . . . . . . . . . . 28-13
Debugging under Windows 2000 . . . . . 27-9 Specifying the HTML template. . . . . 28-14
Converting HTML-transparent
Chapter 28 tags . . . . . . . . . . . . . . . . . . . 28-14
Using Web Broker 28-1 Using page producers from an
Creating Web server applications with action item . . . . . . . . . . . . . . . 28-15
Web Broker . . . . . . . . . . . . . . . . . . . . 28-1 Chaining page producers
The Web module . . . . . . . . . . . . . . . . 28-2 together . . . . . . . . . . . . . . . . . 28-16
The Web Application object . . . . . . . . . . 28-3 Using database information in
The structure of a Web Broker application . . . 28-3 responses . . . . . . . . . . . . . . . . . . . . 28-17
The Web dispatcher . . . . . . . . . . . . . . . . 28-4 Adding a session to the Web module . . . 28-17
Adding actions to the dispatcher . . . . . . . 28-4 Representing database information
Dispatching request messages . . . . . . . . 28-5 in HTML . . . . . . . . . . . . . . . . . . 28-18
Action items . . . . . . . . . . . . . . . . . . . . 28-5 Using dataset page producers . . . . . 28-18
Determining when action items fire . . . . . 28-6 Using table producers . . . . . . . . . . 28-18
The target URL . . . . . . . . . . . . . . . 28-6 Specifying the table attributes . . . . . 28-18

xviii
Specifying the row attributes . . . . . . 28-19 Script objects . . . . . . . . . . . . . . . . . .29-11
Specifying the columns. . . . . . . . . . 28-19 Dispatching requests . . . . . . . . . . . . . . 29-12
Embedding tables in HTML WebContext . . . . . . . . . . . . . . . . . 29-13
documents . . . . . . . . . . . . . . . . 28-19 Dispatcher components. . . . . . . . . . . 29-13
Setting up a dataset table Adapter dispatcher operation . . . . . . . 29-13
producer . . . . . . . . . . . . . . . . . 28-20 Using adapter components to generate
Setting up a query table producer . . . 28-20 content. . . . . . . . . . . . . . . . . . 29-13
Adapter requests and responses . . . . 29-15
Chapter 29 Action request . . . . . . . . . . . . . . 29-15
Using WebSnap 29-1 Action response . . . . . . . . . . . . . 29-15
Creating Web server applications with Image request . . . . . . . . . . . . . . 29-16
WebSnap . . . . . . . . . . . . . . . . . . . . . 29-2 Image response. . . . . . . . . . . . . . 29-17
Server type . . . . . . . . . . . . . . . . . . . 29-2 Dispatching action items . . . . . . . . . . 29-17
Web application module types . . . . . . . . 29-3 Page dispatcher operation . . . . . . . . . 29-18
Web application module options . . . . . . . 29-3 WebSnap tutorial . . . . . . . . . . . . . . . . 29-18
Application components . . . . . . . . . . . 29-4 Create a new application . . . . . . . . . . 29-19
Web modules . . . . . . . . . . . . . . . . . . . . 29-5 Step 1. Start the WebSnap
Web data modules . . . . . . . . . . . . . . . 29-5 application wizard . . . . . . . . . . . 29-19
Structure of a Web data module Step 2. Save the generated files
unit . . . . . . . . . . . . . . . . . . . . . 29-5 and project . . . . . . . . . . . . . . . 29-19
Interfaces implemented by a Web data Step 3. Specify the application title . . 29-19
module . . . . . . . . . . . . . . . . . . . 29-6 Create a CountryTable page . . . . . . . . 29-20
Web page modules . . . . . . . . . . . . . . . 29-6 Step 1. Add a new module . . . . . . . 29-20
Page producer component . . . . . . . . . 29-6 Step 2. Save the new module . . . . . . 29-20
Page name . . . . . . . . . . . . . . . . . . 29-6 Add data components to the CountryTable
Producer template . . . . . . . . . . . . . 29-6 module . . . . . . . . . . . . . . . . . . . 29-20
Interfaces that the Web page module Step 1. Add data-aware
implements . . . . . . . . . . . . . . . . 29-7 components . . . . . . . . . . . . . . . 29-20
Web application modules . . . . . . . . . . . 29-7 Step 2. Specify a key field . . . . . . . . 29-21
Interfaces implemented by a Web Step 3. Add an adapter component . . 29-21
application data module . . . . . . . . . 29-7 Create a grid to display the data. . . . . . 29-22
Interfaces implemented by a Web Step 1. Add a grid . . . . . . . . . . . . 29-22
application page module . . . . . . . . . 29-7 Step 2. Add editing commands to
Adapters . . . . . . . . . . . . . . . . . . . . . . 29-8 the grid . . . . . . . . . . . . . . . . . 29-22
Fields. . . . . . . . . . . . . . . . . . . . . . . 29-8 Add an edit form . . . . . . . . . . . . . . 29-23
Actions. . . . . . . . . . . . . . . . . . . . . . 29-8 Step 1. Add a new module . . . . . . . 29-23
Errors . . . . . . . . . . . . . . . . . . . . . . 29-8 Step 2. Save the new module . . . . . . 29-23
Records . . . . . . . . . . . . . . . . . . . . . 29-8 Step 3. Use the CountryTableU
Page producers . . . . . . . . . . . . . . . . . . . 29-9 unit . . . . . . . . . . . . . . . . . . . 29-23
Templates . . . . . . . . . . . . . . . . . . . . 29-9 Step 4. Add input fields . . . . . . . . . 29-23
Server-side scripting in WebSnap . . . . . . . . 29-9 Step 5. Add buttons . . . . . . . . . . . 29-24
Active scripting . . . . . . . . . . . . . . . . . 29-9 Step 6. Link form actions to the
Script engine . . . . . . . . . . . . . . . . . 29-10 grid page . . . . . . . . . . . . . . . . 29-24
Script blocks. . . . . . . . . . . . . . . . . . 29-10 Step 7. Link grid actions to the
Creating script . . . . . . . . . . . . . . . . 29-10 form page . . . . . . . . . . . . . . . . 29-24
Wizard templates . . . . . . . . . . . . . 29-10 Add error reporting . . . . . . . . . . . . . 29-25
TAdapterPageProducer . . . . . . . . . 29-10 Step 1. Add error support to the
Editing and viewing script . . . . . . . . . 29-10 grid . . . . . . . . . . . . . . . . . . . 29-25
Including script in a page . . . . . . . . . . 29-11

xix
Step 2. Add error support to the Describing sockets . . . . . . . . . . . . . . . . 32-3
form . . . . . . . . . . . . . . . . . . . 29-25 Describing the host . . . . . . . . . . . . . . 32-4
Step 3. Test the error-reporting Choosing between a host name and
mechanism. . . . . . . . . . . . . . . . 29-26 an IP address . . . . . . . . . . . . . . . 32-4
Run the completed application . . . . . . . 29-26 Using ports . . . . . . . . . . . . . . . . . . . 32-5
Using socket components . . . . . . . . . . . . 32-5
Chapter 30 Getting information about the
Working with XML documents 30-1 connection . . . . . . . . . . . . . . . . . . 32-6
Using the Document Object Model . . . . . . . 30-2 Using client sockets . . . . . . . . . . . . . . 32-6
Working with XML components . . . . . . . . . 30-3 Specifying the desired server . . . . . . . 32-6
Using TXMLDocument . . . . . . . . . . . . 30-3 Forming the connection . . . . . . . . . . 32-6
Working with XML nodes . . . . . . . . . . . 30-4 Getting information about the
Working with a node’s value . . . . . . . 30-4 connection . . . . . . . . . . . . . . . . 32-6
Working with a node’s attributes . . . . . 30-5 Closing the connection . . . . . . . . . . 32-7
Adding and deleting child nodes . . . . . 30-5 Using server sockets . . . . . . . . . . . . . 32-7
Abstracting XML documents with the Specifying the port. . . . . . . . . . . . . 32-7
Data Binding wizard. . . . . . . . . . . . . . . 30-5 Listening for client requests . . . . . . . 32-7
Using the XML Data Binding wizard . . . . 30-7 Connecting to clients . . . . . . . . . . . 32-7
Using code that the XML Data Binding Closing server connections . . . . . . . . 32-7
wizard generates . . . . . . . . . . . . . . . 30-8 Responding to socket events. . . . . . . . . . . 32-8
Error events . . . . . . . . . . . . . . . . . . 32-8
Chapter 31 Client events . . . . . . . . . . . . . . . . . . 32-8
Using Web Services 31-1 Server events. . . . . . . . . . . . . . . . . . 32-9
Writing Servers that support Web Events when listening . . . . . . . . . . . 32-9
Services . . . . . . . . . . . . . . . . . . . . . . 31-2 Events with client connections . . . . . . 32-9
Building a Web Service server . . . . . . . . 31-2 Reading and writing over socket
Defining invokable interfaces . . . . . . . 31-3 connections . . . . . . . . . . . . . . . . . . . 32-9
Using complex types in invokable Non-blocking connections . . . . . . . . . . 32-9
interfaces . . . . . . . . . . . . . . . . . . 31-5 Reading and writing events . . . . . . 32-10
Creating and registering the Blocking connections . . . . . . . . . . . . 32-10
implementation . . . . . . . . . . . . . . 31-6
Creating custom exception classes
Part IV
for Web Services . . . . . . . . . . . . . . 31-7 Developing COM-based applications
Generating WSDL documents for a
Web Service application . . . . . . . . . 31-7 Chapter 33
Writing clients for Web Services . . . . . . . . . 31-8 Overview of COM technologies 33-1
Importing WSDL documents . . . . . . . . . 31-8 COM as a specification and
Calling invokable interfaces. . . . . . . . . . 31-9 implementation . . . . . . . . . . . . . 33-1
COM extensions . . . . . . . . . . . . . . 33-2
Chapter 32 Parts of a COM application . . . . . . . . . . . 33-3
Working with sockets 32-1 COM interfaces . . . . . . . . . . . . . . . . 33-3
Implementing services . . . . . . . . . . . . . . 32-1 The fundamental COM interface,
Understanding service protocols . . . . . . . 32-2 IUnknown . . . . . . . . . . . . . . . . 33-4
Communicating with applications . . . . 32-2 COM interface pointers . . . . . . . . . . 33-4
Services and ports . . . . . . . . . . . . . . . 32-2 COM servers . . . . . . . . . . . . . . . . . . 33-5
Types of socket connections. . . . . . . . . . . . 32-2 CoClasses and class factories . . . . . . . 33-6
Client connections . . . . . . . . . . . . . . . 32-3 In-process, out-of-process, and remote
Listening connections . . . . . . . . . . . . . 32-3 servers . . . . . . . . . . . . . . . . . . . 33-6
Server connections . . . . . . . . . . . . . . . 32-3 The marshaling mechanism . . . . . . . 33-8

xx
Aggregation . . . . . . . . . . . . . . . . . 33-9 Adding an enumeration to the type
COM clients . . . . . . . . . . . . . . . . . . . 33-9 library . . . . . . . . . . . . . . . . . . 34-23
COM extensions . . . . . . . . . . . . . . . . . 33-10 Adding an alias to the type library . . 34-23
Automation servers . . . . . . . . . . . . . 33-12 Adding a record or union to the type
Active Server Pages . . . . . . . . . . . . . 33-12 library . . . . . . . . . . . . . . . . . . 34-24
ActiveX controls . . . . . . . . . . . . . . . 33-13 Adding a module to the type
Active Documents . . . . . . . . . . . . . . 33-13 library . . . . . . . . . . . . . . . . . . 34-24
Transactional objects . . . . . . . . . . . . . 33-14 Saving and registering type library
Type libraries . . . . . . . . . . . . . . . . . 33-15 information . . . . . . . . . . . . . . . 34-24
The content of type libraries . . . . . . . 33-15 Apply Updates dialog. . . . . . . . . . 34-25
Creating type libraries . . . . . . . . . . 33-16 Saving a type library . . . . . . . . . . 34-25
When to use type libraries . . . . . . . . 33-16 Refreshing the type library . . . . . . . 34-26
Accessing type libraries . . . . . . . . . 33-16 Registering the type library. . . . . . . 34-26
Benefits of using type libraries . . . . . 33-17 Exporting an IDL file . . . . . . . . . . 34-26
Using type library tools . . . . . . . . . 33-18 Deploying type libraries . . . . . . . . . . . . 34-27
Implementing COM objects with
wizards . . . . . . . . . . . . . . . . . . . . . 33-18 Chapter 35
Code generated by wizards . . . . . . . . . 33-21 Creating COM clients 35-1
Importing type library information . . . . . . . 35-2
Chapter 34 Using the Import Type Library dialog . . . 35-3
Working with type libraries 34-1 Using the Import ActiveX dialog . . . . . . 35-4
Type Library editor . . . . . . . . . . . . . . . . 34-2 Code generated when you import type
Parts of the Type Library editor. . . . . . . . 34-3 library information . . . . . . . . . . . . . 35-5
Toolbar . . . . . . . . . . . . . . . . . . . . 34-3 Controlling an imported object . . . . . . . . . 35-6
Object list pane . . . . . . . . . . . . . . . 34-5 Using component wrappers . . . . . . . . . 35-6
Status bar . . . . . . . . . . . . . . . . . . 34-5 ActiveX wrappers . . . . . . . . . . . . . 35-6
Pages of type information . . . . . . . . . 34-6 Automation object wrappers . . . . . . . 35-7
Type library elements . . . . . . . . . . . . . 34-8 Using data-aware ActiveX controls . . . . . 35-8
Interfaces. . . . . . . . . . . . . . . . . . . 34-8 Example: Printing a document with
Dispinterfaces . . . . . . . . . . . . . . . . 34-9 Microsoft Word . . . . . . . . . . . . . . . 35-9
CoClasses . . . . . . . . . . . . . . . . . . 34-9 Step 1: Prepare Delphi for this
Type definitions . . . . . . . . . . . . . . 34-10 example . . . . . . . . . . . . . . . . . . 35-9
Modules . . . . . . . . . . . . . . . . . . 34-10 Step 2: Import the Word type
Using the Type Library editor. . . . . . . . 34-11 library . . . . . . . . . . . . . . . . . . 35-10
Valid types . . . . . . . . . . . . . . . . . 34-11 Step 3: Use a VTable or dispatch interface
Using Object Pascal or IDL syntax . . . 34-13 object to control Microsoft Word . . . 35-10
Creating a new type library . . . . . . . 34-19 Step 4: Clean up the example . . . . . . .35-11
Opening an existing type library . . . . 34-19 Writing client code based on type library
Adding an interface to the type definitions . . . . . . . . . . . . . . . . . 35-12
library . . . . . . . . . . . . . . . . . . 34-20 Connecting to a server . . . . . . . . . 35-12
Modifying an interface using the Controlling an Automation server
type library . . . . . . . . . . . . . . . 34-20 using a dual interface . . . . . . . . . 35-12
Adding properties and methods to an Controlling an Automation server
interface or dispinterface . . . . . . . . 34-21 using a dispatch interface . . . . . . . 35-13
Adding a CoClass to the type Handling events in an automation
library . . . . . . . . . . . . . . . . . . 34-22 controller . . . . . . . . . . . . . . . . 35-13
Adding an interface to a CoClass . . . . 34-23 Creating Clients for servers that do not
have a type library . . . . . . . . . . . . . . 35-15

xxi
Chapter 36 Registering an out-of-process server . . . . 37-8
Testing and debugging the Active Server
Creating simple COM servers 36-1 Page application. . . . . . . . . . . . . . . . . 37-8
Overview of creating a COM object . . . . . . . 36-2
Designing a COM object . . . . . . . . . . . . . 36-2
Using the COM object wizard . . . . . . . . . . 36-2
Chapter 38
Using the Automation object wizard . . . . . . 36-4 Creating an ActiveX control 38-1
COM object instancing types . . . . . . . . . 36-5 Overview of ActiveX control creation . . . . . 38-2
Choosing a threading model . . . . . . . . . 36-6 Elements of an ActiveX control . . . . . . . 38-2
Writing an object that supports the free VCL control. . . . . . . . . . . . . . . . . 38-3
threading model. . . . . . . . . . . . . . 36-7 ActiveX wrapper. . . . . . . . . . . . . . 38-3
Writing an object that supports the Type library. . . . . . . . . . . . . . . . . 38-3
apartment threading model . . . . . . . 36-8 Property page . . . . . . . . . . . . . . . 38-3
Writing an object that supports the Designing an ActiveX control . . . . . . . . . . 38-4
neutral threading model . . . . . . . . . 36-9 Generating an ActiveX control from a
Defining a COM object’s interface . . . . . . . . 36-9 VCL control . . . . . . . . . . . . . . . . . . . 38-4
Adding a property to the object’s Generating an ActiveX control based on
interface . . . . . . . . . . . . . . . . . . . . 36-9 a VCL form. . . . . . . . . . . . . . . . . . . . 38-5
Adding a method to the object’s Licensing ActiveX controls. . . . . . . . . . . . 38-6
interface . . . . . . . . . . . . . . . . . . . 36-10 Customizing the ActiveX control’s
Exposing events to clients . . . . . . . . . . 36-10 interface . . . . . . . . . . . . . . . . . . . . . 38-7
Managing events in your Adding additional properties, methods,
Automation object . . . . . . . . . . . 36-12 and events . . . . . . . . . . . . . . . . . . 38-8
Automation interfaces . . . . . . . . . . . . . . 36-12 Adding properties and methods . . . . . 38-8
Dual interfaces . . . . . . . . . . . . . . . . 36-13 Adding events . . . . . . . . . . . . . . . 38-9
Dispatch interfaces . . . . . . . . . . . . . . 36-14 Enabling simple data binding with the
Custom interfaces . . . . . . . . . . . . . . 36-14 type library . . . . . . . . . . . . . . . . . 38-10
Marshaling data . . . . . . . . . . . . . . . . . 36-15 Creating a property page for an ActiveX
Automation compatible types . . . . . . . 36-15 control . . . . . . . . . . . . . . . . . . . . . .38-11
Type restrictions for automatic Creating a new property page . . . . . . . 38-12
marshaling . . . . . . . . . . . . . . . . . 36-16 Adding controls to a property page . . . . 38-12
Custom marshaling . . . . . . . . . . . . . 36-16 Associating property page controls with
Registering a COM object . . . . . . . . . . . . 36-16 ActiveX control properties . . . . . . . . 38-13
Registering an in-process server . . . . . . 36-17 Updating the property page . . . . . . 38-13
Registering an out-of-process server . . . . 36-17 Updating the object . . . . . . . . . . . 38-13
Testing and debugging the application . . . . 36-17 Connecting a property page to an ActiveX
control. . . . . . . . . . . . . . . . . . . . 38-14
Chapter 37 Registering an ActiveX control . . . . . . . . 38-14
Testing an ActiveX control . . . . . . . . . . . 38-14
Creating an Active Server Page 37-1 Deploying an ActiveX control on the
Creating an Active Server Object. . . . . . . . . 37-2
Web . . . . . . . . . . . . . . . . . . . . . . . 38-15
Using the ASP intrinsics . . . . . . . . . . . . 37-3
Setting options . . . . . . . . . . . . . . . . 38-16
Application . . . . . . . . . . . . . . . . . 37-4
Request. . . . . . . . . . . . . . . . . . . . 37-4
Response . . . . . . . . . . . . . . . . . . . 37-5
Chapter 39
Session . . . . . . . . . . . . . . . . . . . . 37-5 Creating MTS or COM+ objects 39-1
Server . . . . . . . . . . . . . . . . . . . . 37-6 Understanding transactional objects . . . . . . 39-2
Creating ASPs for in-process or Requirements for a transactional
out-of-process servers . . . . . . . . . . . . 37-7 object . . . . . . . . . . . . . . . . . . . . . 39-3
Registering an Active Server Object . . . . . . . 37-7 Managing resources . . . . . . . . . . . . . . . 39-3
Registering an in-process server . . . . . . . 37-7 Accessing the object context . . . . . . . . . 39-4

xxii
Just-in-time activation . . . . . . . . . . . . . 39-4 Creating nonvisual components . . . . . . . 40-5
Resource pooling . . . . . . . . . . . . . . . . 39-5 What goes into a component? . . . . . . . . . . 40-5
Database resource dispensers . . . . . . . 39-5 Removing dependencies . . . . . . . . . . . 40-5
Shared property manager . . . . . . . . . 39-6 Properties, methods, and events . . . . . . . 40-6
Releasing resources . . . . . . . . . . . . . 39-7 Properties . . . . . . . . . . . . . . . . . . 40-6
Object pooling . . . . . . . . . . . . . . . . . 39-8 Events . . . . . . . . . . . . . . . . . . . . 40-6
MTS and COM+ transaction support . . . . . . 39-8 Methods. . . . . . . . . . . . . . . . . . . 40-6
Transaction attributes . . . . . . . . . . . . . 39-9 Graphics encapsulation . . . . . . . . . . . . 40-7
Setting the transaction attribute . . . . . 39-10 Registration . . . . . . . . . . . . . . . . . . 40-8
Stateful and stateless objects . . . . . . . . 39-11 Creating a new component . . . . . . . . . . . 40-8
Influencing how transactions end . . . . . 39-11 Using the Component wizard . . . . . . . . 40-9
Initiating transactions . . . . . . . . . . . . 39-12 Creating a component manually. . . . . . .40-11
Setting up a transaction object on Creating a unit file . . . . . . . . . . . . .40-11
the client side . . . . . . . . . . . . . . 39-12 Deriving the component . . . . . . . . .40-11
Setting up a transaction object on Registering the component. . . . . . . 40-12
the server side . . . . . . . . . . . . . . 39-13 Testing uninstalled components. . . . . . . . 40-12
Transaction timeout . . . . . . . . . . . . . 39-14 Testing installed components . . . . . . . . . 40-14
Role-based security . . . . . . . . . . . . . . . 39-14
Overview of creating transactional Chapter 41
objects . . . . . . . . . . . . . . . . . . . . . . 39-15 Object-oriented programming for
Using the Transactional Object wizard . . . . 39-15
Choosing a threading model for a
component writers 41-1
Defining new classes . . . . . . . . . . . . . . . 41-1
transactional object . . . . . . . . . . . . . 39-16
Deriving new classes . . . . . . . . . . . . . 41-2
Activities . . . . . . . . . . . . . . . . . . 39-17
To change class defaults to avoid
Generating events under COM+ . . . . . . . . 39-18
repetition . . . . . . . . . . . . . . . . . 41-2
Using the Event Object wizard . . . . . . . 39-19
To add new capabilities to a class . . . . 41-2
Firing events using a COM+ event
Declaring a new component class . . . . . . 41-3
object . . . . . . . . . . . . . . . . . . . . . 39-20
Ancestors, descendants, and class
Passing object references . . . . . . . . . . . . 39-20
hierarchies . . . . . . . . . . . . . . . . . . . . 41-3
Using the SafeRef method . . . . . . . . 39-20
Controlling access. . . . . . . . . . . . . . . . . 41-4
Callbacks. . . . . . . . . . . . . . . . . . 39-21
Hiding implementation details . . . . . . . 41-4
Debugging and testing transactional
Defining the component writer’s
objects . . . . . . . . . . . . . . . . . . . . . . 39-21
interface. . . . . . . . . . . . . . . . . . . . 41-5
Installing transactional objects . . . . . . . . . 39-22
Defining the runtime interface . . . . . . . . 41-6
Administering transactional objects . . . . . . 39-23
Defining the design-time interface . . . . . 41-6
Dispatching methods . . . . . . . . . . . . . . . 41-7
Part V Static methods . . . . . . . . . . . . . . . . . 41-7
Creating custom components An example of static methods . . . . . . 41-7
Virtual methods . . . . . . . . . . . . . . . . 41-8
Chapter 40 Overriding methods . . . . . . . . . . . . 41-8
Overview of component creation 40-1 Abstract class members . . . . . . . . . . . . . 41-9
VCL and CLX. . . . . . . . . . . . . . . . . . . . 40-1 Classes and pointers . . . . . . . . . . . . . . . 41-9
Components and classes . . . . . . . . . . . . . 40-2
How do you create components? . . . . . . . . 40-2 Chapter 42
Modifying existing controls . . . . . . . . . . 40-3 Creating properties 42-1
Creating windowed controls . . . . . . . . . 40-3 Why create properties? . . . . . . . . . . . . . . 42-1
Creating graphic controls . . . . . . . . . . . 40-4 Types of properties . . . . . . . . . . . . . . . . 42-2
Subclassing Windows controls . . . . . . . . 40-4 Publishing inherited properties . . . . . . . . . 42-2

xxiii
Defining properties . . . . . . . . . . . . . . . . 42-3 Declaring the event . . . . . . . . . . . . . . 43-8
The property declaration . . . . . . . . . . . 42-3 Event names start with “On” . . . . . . . 43-8
Internal data storage . . . . . . . . . . . . . . 42-4 Calling the event. . . . . . . . . . . . . . . . 43-8
Direct access. . . . . . . . . . . . . . . . . . . 42-4
Access methods. . . . . . . . . . . . . . . . . 42-5 Chapter 44
The read method . . . . . . . . . . . . . . 42-6 Creating methods 44-1
The write method . . . . . . . . . . . . . . 42-6 Avoiding dependencies . . . . . . . . . . . . . 44-1
Default property values . . . . . . . . . . . . 42-7 Naming methods . . . . . . . . . . . . . . . . . 44-2
Specifying no default value . . . . . . . . 42-7 Protecting methods . . . . . . . . . . . . . . . . 44-2
Creating array properties . . . . . . . . . . . . . 42-8 Methods that should be public. . . . . . . . 44-3
Creating properties for subcomponents . . . . . 42-8 Methods that should be protected . . . . . . 44-3
Creating properties for interfaces . . . . . . . 42-10 Abstract methods . . . . . . . . . . . . . . . 44-3
Storing and loading properties . . . . . . . . . 42-11 Making methods virtual . . . . . . . . . . . . . 44-4
Using the store-and-load mechanism . . . 42-11 Declaring methods . . . . . . . . . . . . . . . . 44-4
Specifying default values . . . . . . . . . . 42-11
Determining what to store. . . . . . . . . . 42-12 Chapter 45
Initializing after loading . . . . . . . . . . . 42-13 Using graphics in components 45-1
Storing and loading unpublished Overview of graphics. . . . . . . . . . . . . . . 45-1
properties . . . . . . . . . . . . . . . . . . 42-13 Using the canvas . . . . . . . . . . . . . . . . . 45-3
Creating methods to store and load Working with pictures . . . . . . . . . . . . . . 45-3
property values . . . . . . . . . . . . . 42-14 Using a picture, graphic, or canvas . . . . . 45-3
Overriding the DefineProperties Loading and storing graphics . . . . . . . . 45-4
method . . . . . . . . . . . . . . . . . . 42-14 Handling palettes . . . . . . . . . . . . . . . 45-5
Specifying a palette for a control . . . . . 45-5
Chapter 43 Off-screen bitmaps . . . . . . . . . . . . . . . . 45-6
Creating events 43-1 Creating and managing off-screen
What are events? . . . . . . . . . . . . . . . . . . 43-1 bitmaps . . . . . . . . . . . . . . . . . . . . 45-6
Events are method pointers . . . . . . . . . . 43-2 Copying bitmapped images . . . . . . . . . 45-6
Events are properties. . . . . . . . . . . . . . 43-2 Responding to changes. . . . . . . . . . . . . . 45-7
Event types are method-pointer types . . . . 43-3
Event-handler types are procedures . . . 43-3 Chapter 46
Event handlers are optional . . . . . . . . . . 43-4 Handling messages 46-1
Implementing the standard events. . . . . . . . 43-4 Understanding the message-handling
Identifying standard events . . . . . . . . . . 43-4 system . . . . . . . . . . . . . . . . . . . . . . 46-1
Standard events for all controls . . . . . . 43-4 What’s in a Windows message? . . . . . . . 46-2
Standard events for standard Dispatching messages. . . . . . . . . . . . . 46-2
controls . . . . . . . . . . . . . . . . . . . 43-5 Tracing the flow of messages . . . . . . . 46-3
Making events visible . . . . . . . . . . . . . 43-5 Changing message handling. . . . . . . . . . . 46-3
Changing the standard event handling . . . 43-6 Overriding the handler method . . . . . . . 46-3
Defining your own events . . . . . . . . . . . . 43-6 Using message parameters . . . . . . . . . . 46-4
Triggering the event . . . . . . . . . . . . . . 43-7 Trapping messages . . . . . . . . . . . . . . 46-4
Two kinds of events . . . . . . . . . . . . 43-7 Creating new message handlers. . . . . . . . . 46-5
Defining the handler type . . . . . . . . . . . 43-7 Defining your own messages . . . . . . . . 46-5
Simple notifications. . . . . . . . . . . . . 43-7 Declaring a message identifier . . . . . . 46-6
Event-specific handlers. . . . . . . . . . . 43-7 Declaring a message-record type. . . . . 46-6
Returning information from the Declaring a new message-handling
handler . . . . . . . . . . . . . . . . . . . 43-8 method . . . . . . . . . . . . . . . . . . . . 46-7

xxiv
Chapter 47 Chapter 49
Making components available at Creating a graphic component 49-1
design time 47-1 Creating and registering the component . . . . 49-1
Registering components. . . . . . . . . . . . . . 47-1 Publishing inherited properties . . . . . . . . . 49-2
Declaring the Register procedure. . . . . . . 47-2 Adding graphic capabilities . . . . . . . . . . . 49-3
Writing the Register procedure . . . . . . . . 47-2 Determining what to draw . . . . . . . . . . 49-3
Specifying the components . . . . . . . . 47-2 Declaring the property type . . . . . . . 49-3
Specifying the palette page . . . . . . . . 47-3 Declaring the property . . . . . . . . . . 49-4
Using the RegisterComponents Writing the implementation method . . 49-4
function . . . . . . . . . . . . . . . . . . 47-3 Overriding the constructor and
Adding palette bitmaps . . . . . . . . . . . . . . 47-3 destructor. . . . . . . . . . . . . . . . . . . 49-4
Providing Help for your component. . . . . . . 47-4 Changing default property values . . . . 49-4
Creating the Help file . . . . . . . . . . . . . 47-4 Publishing the pen and brush . . . . . . . . 49-5
Creating the entries . . . . . . . . . . . . . 47-4 Declaring the class fields . . . . . . . . . 49-5
Making component help Declaring the access properties. . . . . . 49-6
context-sensitive . . . . . . . . . . . . . 47-6 Initializing owned classes. . . . . . . . . 49-6
Adding component help files . . . . . . . 47-6 Setting owned classes’ properties . . . . 49-7
Adding property editors . . . . . . . . . . . . . 47-6 Drawing the component image . . . . . . . 49-8
Deriving a property-editor class . . . . . . . 47-7 Refining the shape drawing . . . . . . . . . 49-9
Editing the property as text . . . . . . . . . . 47-8
Displaying the property value. . . . . . . 47-8 Chapter 50
Setting the property value . . . . . . . . . 47-8 Customizing a grid 50-1
Editing the property as a whole . . . . . . . 47-9 Creating and registering the component . . . . 50-1
Specifying editor attributes . . . . . . . . . 47-10 Publishing inherited properties . . . . . . . . . 50-2
Registering the property editor . . . . . . . 47-11 Changing initial values. . . . . . . . . . . . . . 50-3
Property categories . . . . . . . . . . . . . . . 47-12 Resizing the cells . . . . . . . . . . . . . . . . . 50-4
Registering one property at a time . . . . . 47-13 Filling in the cells . . . . . . . . . . . . . . . . . 50-5
Registering multiple properties at Tracking the date . . . . . . . . . . . . . . . 50-5
once . . . . . . . . . . . . . . . . . . . . . 47-13 Storing the internal date . . . . . . . . . 50-6
Specifying property categories . . . . . . . 47-14 Accessing the day, month, and year . . . 50-6
Using the IsPropertyInCategory Generating the day numbers . . . . . . . 50-8
function . . . . . . . . . . . . . . . . . . . 47-15 Selecting the current day . . . . . . . . . 50-9
Adding component editors . . . . . . . . . . . 47-15 Navigating months and years . . . . . . . . . 50-10
Adding items to the context menu . . . . . 47-16 Navigating days. . . . . . . . . . . . . . . . . .50-11
Specifying menu items . . . . . . . . . . 47-16 Moving the selection . . . . . . . . . . . . .50-11
Implementing commands . . . . . . . . 47-16 Providing an OnChange event. . . . . . . .50-11
Changing the double-click behavior . . . . 47-17 Excluding blank cells . . . . . . . . . . . . 50-12
Adding clipboard formats . . . . . . . . . . 47-18
Registering the component editor . . . . . 47-18 Chapter 51
Compiling components into packages. . . . . 47-19 Making a control data aware 51-1
Creating a data-browsing control . . . . . . . . 51-1
Chapter 48 Creating and registering the
Modifying an existing component 48-1 component . . . . . . . . . . . . . . . . . . 51-2
Creating and registering the component . . . . 48-1 Making the control read-only . . . . . . . . 51-2
Modifying the component class . . . . . . . . . 48-2 Adding the ReadOnly property . . . . . 51-3
Overriding the constructor . . . . . . . . . . 48-2 Allowing needed updates. . . . . . . . . 51-3
Specifying the new default property Adding the data link . . . . . . . . . . . . . 51-4
value . . . . . . . . . . . . . . . . . . . . . . 48-3 Declaring the class field . . . . . . . . . . 51-4

xxv
Declaring the access properties . . . . . . 51-5 Modifying the Change method . . . . . . .51-11
An example of declaring access Updating the dataset . . . . . . . . . . . . .51-11
properties . . . . . . . . . . . . . . . . . 51-5
Initializing the data link . . . . . . . . . . 51-6 Chapter 52
Responding to data changes . . . . . . . . . 51-6 Making a dialog box a component 52-1
Creating a data-editing control . . . . . . . . . . 51-7 Defining the component interface. . . . . . . . 52-1
Changing the default value of Creating and registering the component . . . . 52-2
FReadOnly . . . . . . . . . . . . . . . . . . 51-8 Creating the component interface. . . . . . . . 52-3
Handling mouse-down and key-down Including the form unit . . . . . . . . . . . . 52-3
messages. . . . . . . . . . . . . . . . . . . . 51-8 Adding interface properties . . . . . . . . . 52-3
Responding to mouse-down Adding the Execute method . . . . . . . . . 52-4
messages . . . . . . . . . . . . . . . . . . 51-8 Testing the component . . . . . . . . . . . . . . 52-6
Responding to key-down messages . . . 51-9
Updating the field datalink class . . . . . . 51-10 Index I-1

xxvi
Tables
1.1 Typefaces and symbols . . . . . . . . . . . 1-3 8.5 Multimedia device types and their
3.1 Important base classes . . . . . . . . . . . 3-13 functions . . . . . . . . . . . . . . . . . . . 8-32
3.2 Graphic controls . . . . . . . . . . . . . . . 3-17 9.1 Thread priorities . . . . . . . . . . . . . . . 9-3
3.3 Component palette pages . . . . . . . . . 3-29 9.2 WaitFor return values . . . . . . . . . . . 9-10
3.4 Text control properties . . . . . . . . . . . 3-31 10.1 Porting techniques . . . . . . . . . . . . . 10-3
3.5 Components for creating and 10.2 CLX parts . . . . . . . . . . . . . . . . . . 10-6
managing lists . . . . . . . . . . . . . . . . 3-47 10.3 Changed or different features . . . . . . . 10-9
4.1 RTL exceptions . . . . . . . . . . . . . . . . 4-9 10.4 VCL and equivalent CLX units . . . . . 10-10
4.2 Object Pascal character types . . . . . . . . 4-40 10.5 Units in CLX, not VCL . . . . . . . . . . .10-11
4.3 String comparison routines . . . . . . . . . 4-44 10.6 VCL-only units . . . . . . . . . . . . . . .10-11
4.4 Case conversion routines . . . . . . . . . . 4-44 10.7 Differences in the Linux and Windows
4.5 String modification routines . . . . . . . . 4-45 operating environments . . . . . . . . . 10-14
4.6 Sub-string routines . . . . . . . . . . . . . 4-45 10.8 Common Linux directories . . . . . . . 10-16
4.7 String handling routines . . . . . . . . . . 4-45 10.9 TWidgetControl protected methods
4.8 Compiler directives for strings . . . . . . . 4-49 for responding to system events . . . . 10-21
4.9 Attribute constants and values . . . . . . . 4-51 10.10 Comparable data-access
4.10 File types for file I/O . . . . . . . . . . . . 4-53 components . . . . . . . . . . . . . . . . 10-24
4.11 Open modes . . . . . . . . . . . . . . . . . 4-54 10.11 Properties, methods, and events
4.12 Shared modes . . . . . . . . . . . . . . . . 4-54 for cached updates . . . . . . . . . . . . 10-28
4.13 Shared modes available for each 11.1 Compiled package files . . . . . . . . . . 11-2
open mode . . . . . . . . . . . . . . . . . . 4-55 11.2 Package-specific compiler
5.1 Compiler directives for libraries . . . . . . 5-9 directives . . . . . . . . . . . . . . . . . .11-10
5.2 Database pages on the Component 11.3 Package-specific command-line
palette . . . . . . . . . . . . . . . . . . . . . 5-10 compiler switches. . . . . . . . . . . . . .11-12
5.3 Web server applications . . . . . . . . . . . 5-12 11.4 Compiled package files . . . . . . . . . .11-12
5.4 Context menu options for data 12.1 VCL objects that support BiDi. . . . . . . 12-4
modules. . . . . . . . . . . . . . . . . . . . 5-16 12.2 Estimating string lengths . . . . . . . . . 12-9
5.5 Help methods in TApplication . . . . . . . 5-28 13.1 Application files . . . . . . . . . . . . . . 13-3
6.1 Action setup terminology. . . . . . . . . . 6-16 13.2 Merge modules and their
6.2 Default values of the action manager’s dependencies . . . . . . . . . . . . . . . . 13-4
PrioritySchedule property . . . . . . . . . 6-22 13.3 dbExpress deployment as standalone
6.3 Action classes . . . . . . . . . . . . . . . . 6-27 executable . . . . . . . . . . . . . . . . . . 13-7
6.4 Sample captions and their derived 13.4 dbExpress deployment, driver DLLs . . . 13-7
names . . . . . . . . . . . . . . . . . . . . . 6-31 13.5 SQL database client software files . . . . 13-9
6.5 Menu Designer context menu 15.1 Data controls . . . . . . . . . . . . . . . . 15-2
commands . . . . . . . . . . . . . . . . . . 6-36 15.2 Column properties . . . . . . . . . . . . 15-19
6.6 Setting speed buttons’ appearance. . . . . 6-44 15.3 Expanded TColumn Title
6.7 Setting tool buttons’ appearance . . . . . . 6-46 properties . . . . . . . . . . . . . . . . . 15-20
6.8 Setting a cool button’s appearance. . . . . 6-47 15.4 Properties that affect the way
7.1 Properties of selected text. . . . . . . . . . 7-8 composite fields appear . . . . . . . . . 15-23
7.2 Fixed vs. variable owner-draw styles . . . 7-12 15.5 Expanded TDBGrid Options
8.1 Graphic object types . . . . . . . . . . . . . 8-3 properties . . . . . . . . . . . . . . . . . 15-24
8.2 Common properties of the Canvas 15.6 Grid control events . . . . . . . . . . . . 15-26
object . . . . . . . . . . . . . . . . . . . . . 8-4 15.7 Selected database control grid
8.3 Common methods of the Canvas properties . . . . . . . . . . . . . . . . . 15-27
object . . . . . . . . . . . . . . . . . . . . . 8-4 15.8 TDBNavigator buttons . . . . . . . . . . 15-28
8.4 Mouse-event parameters . . . . . . . . . . 8-24 17.1 Database connection components . . . . 17-1

xxvii
18.1 Values for the dataset State property . . . 18-3 22.5 Columns in tables of metadata listing
18.2 Navigational methods of datasets . . . . . 18-5 parameters. . . . . . . . . . . . . . . . . 22-16
18.3 Navigational properties of datasets . . . . 18-6 23.1 Filter support in client datasets . . . . . . 23-3
18.4 Comparison and logical operators 23.2 Summary operators for maintained
that can appear in a filter . . . . . . . . 18-14 aggregates . . . . . . . . . . . . . . . . . .23-11
18.5 FilterOptions values . . . . . . . . . . . . 18-15 23.3 Specialized client datasets for
18.6 Filtered dataset navigational caching updates. . . . . . . . . . . . . . 23-17
methods. . . . . . . . . . . . . . . . . . . 18-16 24.1 AppServer interface members. . . . . . . 24-3
18.7 Dataset methods for inserting, 24.2 Provider options . . . . . . . . . . . . . . 24-5
updating, and deleting data . . . . . . . 18-17 24.3 UpdateStatus values . . . . . . . . . . . . 24-9
18.8 Methods that work with entire 24.4 UpdateMode values . . . . . . . . . . . 24-10
records . . . . . . . . . . . . . . . . . . . 18-21 24.5 ProviderFlags values . . . . . . . . . . . 24-10
18.9 Index-based search methods . . . . . . . 18-27 25.1 Components used in multi-tiered
19.1 TFloatField properties that affect applications . . . . . . . . . . . . . . . . . 25-3
data display . . . . . . . . . . . . . . . . . 19-1 25.2 Connection components . . . . . . . . . . 25-5
19.2 Special persistent field kinds . . . . . . . . 19-6 25.3 Javascript libraries . . . . . . . . . . . . 25-35
19.3 Field component properties . . . . . . . 19-11 27.1 Web Broker versus WebSnap . . . . . . . 27-2
19.4 Field component formatting 27.2 Web server application components . . . 27-6
routines . . . . . . . . . . . . . . . . . . . 19-15 28.1 MethodType values. . . . . . . . . . . . . 28-6
19.5 Field component events. . . . . . . . . . 19-15 33.1 COM object requirements . . . . . . . . .33-11
19.6 Selected field component methods . . . 19-16 33.2 Delphi wizards for implementing COM,
19.7 Special conversion results. . . . . . . . . 19-19 Automation, and ActiveX objects . . . . 33-19
19.8 Types of object field components . . . . 19-22 33.3 DAX Base classes for generated
19.9 Common object field descendant implementation classes . . . . . . . . . 33-21
properties . . . . . . . . . . . . . . . . . . 19-23 34.1 Type Library editor files . . . . . . . . . . 34-2
20.1 Table types recognized by the BDE 34.2 Type Library editor parts . . . . . . . . . 34-3
based on file extension . . . . . . . . . . . 20-5 34.3 Type library pages . . . . . . . . . . . . . 34-6
20.2 TableType values. . . . . . . . . . . . . . . 20-5 34.4 Valid types. . . . . . . . . . . . . . . . . 34-12
20.3 BatchMove import modes . . . . . . . . . 20-8 34.5 Attribute syntax. . . . . . . . . . . . . . 34-14
20.4 Database-related informational methods 36.1 Threading models for COM objects . . . 36-6
for session components . . . . . . . . . . 20-26 37.1 IApplicationObject interface
20.5 TSessionList properties and members . . . . . . . . . . . . . . . . . . . 37-4
methods. . . . . . . . . . . . . . . . . . . 20-29 37.2 IRequest interface members . . . . . . . . 37-4
20.6 Properties, methods, and events for 37.3 IResponse interface members . . . . . . . 37-5
cached updates. . . . . . . . . . . . . . . 20-32 37.4 ISessionObject interface members . . . . 37-6
20.7 UpdateKind values . . . . . . . . . . . . 20-38 37.5 IServer interface members . . . . . . . . . 37-6
20.8 Batch move modes. . . . . . . . . . . . . 20-49 39.1 IObjectContext methods for transaction
20.9 Data Dictionary interface . . . . . . . . . 20-52 support. . . . . . . . . . . . . . . . . . . .39-11
21.1 ADO components . . . . . . . . . . . . . . 21-2 39.2 Threading models for transactional
21.2 ADO connection modes . . . . . . . . . . 21-6 objects . . . . . . . . . . . . . . . . . . . 39-17
21.3 Execution options for ADO 39.3 Call synchronization options . . . . . . 39-18
datasets . . . . . . . . . . . . . . . . . . . 21-12 40.1 Component creation starting points . . . 40-3
21.4 Comparison of ADO and client dataset 41.1 Levels of visibility within an object . . . . 41-4
cached updates. . . . . . . . . . . . . . . 21-12 42.1 How properties appear in the Object
22.1 Columns in tables of metadata listing Inspector . . . . . . . . . . . . . . . . . . . 42-2
tables . . . . . . . . . . . . . . . . . . . . 22-14 45.1 Canvas capability summary . . . . . . . . 45-3
22.2 Columns in tables of metadata listing 45.2 Image-copying methods . . . . . . . . . . 45-7
stored procedures . . . . . . . . . . . . . 22-14 47.1 Predefined property-editor types . . . . . 47-7
22.3 Columns in tables of metadata listing 47.2 Methods for reading and writing
fields . . . . . . . . . . . . . . . . . . . . 22-15 property values . . . . . . . . . . . . . . . 47-8
22.4 Columns in tables of metadata listing 47.3 Property-editor attribute flags. . . . . . 47-10
indexes . . . . . . . . . . . . . . . . . . . 22-16 47.4 Property categories . . . . . . . . . . . . 47-14

xxviii
Figures
3.1 A simple form . . . . . . . . . . . . . . . . 3-6 15.5 TDBCtrlGrid at design time . . . . . . . 15-27
3.2 Objects, components, and controls. . . . . 3-12 15.6 Buttons on the TDBNavigator
3.3 A simplified hierarchy diagram . . . . . . 3-13 control . . . . . . . . . . . . . . . . . . . 15-28
3.4 Three views of the track bar 16.1 Decision support components at
component . . . . . . . . . . . . . . . . . . 3-33 design time . . . . . . . . . . . . . . . . . 16-2
3.5 A progress bar . . . . . . . . . . . . . . . . 3-42 16.2 One-dimensional crosstab . . . . . . . . . 16-3
6.1 A frame with data-aware controls 16.3 Three-dimensional crosstab . . . . . . . . 16-3
and a data source component . . . . . . . 6-15 16.4 Decision graphs bound to different
6.2 The Action Manager editor.. . . . . . . . . 6-20 decision sources. . . . . . . . . . . . . . 16-14
6.3 Menu terminology. . . . . . . . . . . . . . 6-29 20.1 Components in a BDE-based
6.4 MainMenu and PopupMenu application. . . . . . . . . . . . . . . . . . 20-2
components . . . . . . . . . . . . . . . . . 6-30 25.1 Web-based multi-tiered database
6.5 Menu Designer for a pop-up menu . . . . 6-31 application. . . . . . . . . . . . . . . . . 25-31
6.6 Menu Designer for a main menu . . . . . 6-31 27.1 Parts of a Uniform Resource
6.7 Nested menu structures. . . . . . . . . . . 6-34 Locator . . . . . . . . . . . . . . . . . . . . 27-3
8.1 Bitmap-dimension dialog box from the 28.1 Structure of a Server Application . . . . . 28-3
BMPDlg unit.. . . . . . . . . . . . . . . . . 8-20 29.1 Generating Content Flow . . . . . . . . 29-14
12.1 TListBox set to bdLeftToRight . . . . . . . 12-7 29.2 Action request and response . . . . . . 29-16
12.2 TListBox set to bdRightToLeft . . . . . . . 12-7 29.3 Image response to a request . . . . . . . 29-17
12.3 TListBox set to bdRightToLeft- 29.4 Dispatching a page . . . . . . . . . . . . 29-18
NoAlign. . . . . . . . . . . . . . . . . . . . 12-7 33.1 A COM interface . . . . . . . . . . . . . . 33-3
12.4 TListBox set to bdRightToLeft- 33.2 Interface vtable . . . . . . . . . . . . . . . 33-5
ReadingOnly . . . . . . . . . . . . . . . . . 12-7 33.3 In-process server . . . . . . . . . . . . . . 33-7
14.1 Generic Database Architecture . . . . . . . 14-6 33.4 Out-of-process and remote servers . . . . 33-8
14.2 Connecting directly to the database 33.5 COM-based technologies . . . . . . . . .33-11
server . . . . . . . . . . . . . . . . . . . . . 14-8 33.6 Simple COM object interface . . . . . . 33-18
14.3 A file-based database application . . . . . 14-9 33.7 Automation object interface . . . . . . . 33-19
14.4 Architecture combining a client 33.8 ActiveX object interface . . . . . . . . . 33-19
dataset and another dataset . . . . . . . 14-12 33.9 Delphi ActiveX framework . . . . . . . 33-21
14.5 Multi-tiered database architecture . . . . 14-13 34.1 Type Library editor . . . . . . . . . . . . . 34-3
15.1 TDBGrid control . . . . . . . . . . . . . . 15-15 34.2 Object list pane . . . . . . . . . . . . . . . 34-5
15.2 TDBGrid control with ObjectView 36.1 Dual interface VTable . . . . . . . . . . 36-13
set to False . . . . . . . . . . . . . . . . . 15-22 38.1 Mask Edit property page in design
15.3 TDBGrid control with Expanded mode . . . . . . . . . . . . . . . . . . . . 38-12
set to False . . . . . . . . . . . . . . . . . 15-23 40.1 Visual Component Library class
15.4 TDBGrid control with Expanded hierarchy. . . . . . . . . . . . . . . . . . . 40-2
set to True. . . . . . . . . . . . . . . . . . 15-23 40.2 Component wizard . . . . . . . . . . . . . 40-9

xxix
xxx
Chapter

1
Introduction
Chapter1

The Developer’s Guide describes intermediate and advanced development topics, such
as building client/server database applications, writing custom components, and
creating Internet Web server applications. It allows you to build applications that
meet many industry-standard specifications such as SOAP, TCP/IP, COM+, and
ActiveX. Many of the advanced features that support Web development, advanced
XML technologies, and database development require components or wizards that
are not available in all versions of Delphi.
The Developer’s Guide assumes you are familiar with using Delphi and understand
fundamental Delphi programming techniques. For an introduction to Delphi
programming and the integrated development environment (IDE), see the Quick
Start manual or the online Help.

What’s in this manual?


This manual contains five parts, as follows:
• Part I, “Programming with Delphi,” describes how to build general-purpose
Delphi applications. This part provides details on programming techniques you
can use in any Delphi application. For example, it describes how to use common
Visual Component Library (VCL) or Component Library for Cross-platform (CLX)
objects that make user interface programming easy. Objects are available for
handling strings, manipulating text, implementing common dialogs, and so on.
This section also includes chapters on working with graphics, error and exception
handling, using DLLs, OLE automation, and writing international applications.
A chapter describes how to use objects in the Borland Component Library for
Cross-Platform (CLX) to develop applications that can be compiled and run on
either Windows or Linux platforms.

Introduction 1-1
What’s in this manual?

The chapter on deployment details the tasks involved in deploying your


application to your application users. For example, it includes information on
effective compiler options, using InstallShield Express, licensing issues, and how
to determine which packages, DLLs, and other libraries to use when building the
production-quality version of your application.
• Part II, “Developing database applications,” describes how to build database
applications using database tools and components. Delphi lets you access many
types of databases, including local databases such as Paradox and dBASE, and
network SQL server databases like InterBase, Oracle, and Sybase. You can choose
from a variety of data access mechanisms, including dbExpress, the Borland
Database Engine, InterbaseExpress, and ADO. To implement the more advanced
database applications, you need the Delphi features that are not available in all
versions.
• Part III, “Writing Internet applications,” describes how to create applications that
are distributed over the internet. Delphi includes a wide array of tools for writing
Web server applications, including the Web Broker architecture, which lets you
create cross-platform server applications, WebSnap, which lets you design Web
pages in a GUI environment, support for working with XML documents, and an
architecture for using SOAP-based Web Services. For lower-level support that
underlies much of the messaging in Internet applications, this section also
describes how to work with socket components. The components that implement
many of these features are not available in all versions of Delphi.
• Part IV, “Developing COM-based applications,” describes how to build
applications that can interoperate with other COM-based API objects on the
system such as Windows Shell extensions or multimedia applications. Delphi
contains components that support the ActiveX, COM+, and a COM-based library
for COM controls that can be used for general-purpose and Web-based
applications. Support for COM controls is not available in all editions of Delphi.
To create ActiveX controls, you need the Professional or Enterprise edition.
• Part V, “Creating custom components,” describes how to design and implement
your own components, and how to make them available on the Component
palette of the IDE. A component can be almost any program element that you
want to manipulate at design time. Implementing custom components entails
deriving a new class from an existing class type in the VCL or CLX class libraries.

1-2 Developer’s Guide


Manual conventions

Manual conventions
This manual uses the typefaces and symbols described in Table 1.1 to indicate special
text.

Table 1.1 Typefaces and symbols


Typeface or symbol Meaning
Monospace type Monospaced text represents text as it appears on screen or in Object Pascal
code. It also represents anything you must type.
[] Square brackets in text or syntax listings enclose optional items. Text of this
sort should not be typed verbatim.
Boldface Boldfaced words in text or code listings represent Object Pascal keywords
or compiler options.
Italics Italicized words in text represent Object Pascal identifiers, such as variable
or type names. Italics are also used to emphasize certain words, such as
new terms.
Keycaps This typeface indicates a key on your keyboard. For example, “Press Esc to
exit a menu.”

Developer support services


Inprise also offers a variety of support options to meet the needs of its diverse
developer community. To find out about support offerings for Delphi, refer to
http://www.borland.com/devsupport/delphi.
Additional Delphi Technical Information documents and answers to Frequently
Asked Questions (FAQs) are also available at this Web site.
From the Web site, you can access many newsgroups where Delphi developers
exchange information, tips, and techniques. The site also includes a list of books
about Delphi.

Ordering printed documentation


For information about ordering additional documentation, refer to the Web site at
shop.borland.com.

Introduction 1-3
1-4 Developer’s Guide
Part

I
Programming with Delphi
Part I

The chapters in “Programming with Delphi” introduce concepts and skills necessary
for creating Delphi applications using any edition of the product. They also introduce
the concepts discussed in later sections of the Developer’s Guide.

Programming with Delphi


Chapter

Developing applications with Delphi


Chapter 2
2
Borland Delphi is an object-oriented, visual programming environment for rapid
development of 32-bit applications for deployment on Windows and Linux. Using
Delphi, you can create highly efficient applications with a minimum of manual
coding.
Delphi provides a comprehensive class library called the Visual Component Library
(VCL), Borland Component Library for Cross Platform (CLX), and a suite of Rapid
Application Development (RAD) design tools, including application and form
templates, and programming wizards. Delphi supports truly object-oriented
programming:
• the VCL class library includes objects that encapsulate the Windows API as well as
other useful programming techniques (Windows)
• the CLX class library includes objects that encapsulate the Qt library (Windows or
Linux)
This chapter briefly describes the Delphi development environment and how it fits
into the development life cycle. The rest of this manual provides technical details on
developing general-purpose, database, Internet and Intranet applications, and
includes information on creating ActiveX and COM controls and writing your own
components.

Integrated development environment


When you start Delphi, you are immediately placed within the integrated
development environment, also called the IDE. This environment provides all the
tools you need to design, develop, test, debug, and deploy applications.
Delphi’s development environment includes a visual form designer, Object
Inspector, Object TreeView, Component palette, Project Manager, source code editor,
and debugger among other tools. Some tools may not be included in all versions of
the product. You can move freely from the visual representation of an object (in the

Developing applications with Delphi 2-1


Designing applications

form designer), to the Object Inspector to edit the initial runtime state of the object, to
the source code editor to edit the execution logic of the object. Changing code-related
properties, such as the name of an event handler, in the Object Inspector
automatically changes the corresponding source code. In addition, changes to the
source code, such as renaming an event handler method in a form class declaration,
is immediately reflected in the Object Inspector.
The IDE supports application development throughout the stages of the product life
cycle—from design to deployment. Using the tools in the IDE allows for rapid
prototyping and shortens development time.
A more complete overview of the development environment is presented in the
Quick Start manual included with the product. In addition, the online Help system
provides help on all menus, dialogs, and windows.

Designing applications
Delphi includes all the tools necessary to start designing applications:
• A blank window, known as a form, on which to design the UI for your application.
• Extensive class libraries with many reusable objects.
• An Object Inspector for examining and changing object traits.
• A Code editor that provides direct access to the underlying program logic.
• A Project Manager for managing the files that make up one or more projects.
• Many other tools such as an image editor on the toolbar and an integrated
debugger on menus to support application development in the IDE.
• Command-line tools including compilers, linkers, and other utilities.
You can use Delphi to design any kind of 32-bit application—from general-purpose
utilities to sophisticated data access programs or distributed applications. Delphi’s
database tools and data-aware components let you quickly develop powerful
desktop database and client/server applications. Using Delphi’s data-aware controls,
you can view live data while you design your application and immediately see the
results of database queries and changes to the application interface.
Chapter 5, “Building applications, components, and libraries” introduces Delphi’s
support for different types of applications.
Many of the objects provided in the class library are accessible in the IDE from the
Component palette. The Component palette shows all of the controls, both visual and
nonvisual, that you can place on a form. Each tab contains components grouped by
functionality. By convention, the names of objects in the class library begin with a T,
such as TStatusBar.
One of the revolutionary things about Delphi is that you can create your own
components using Object Pascal. Most of the components provided are written in
Object Pascal. You can add components that you write to the Component palette and
customize the palette for your use by including new tabs if needed.
You can also use Delphi for cross platform development on both Linux and Windows
by using CLX. CLX contains a set of classes that, if used instead of those in the VCL,
allow your program to port between Windows and Linux.

2-2 Developer’s Guide


Developing applications

Developing applications
As you visually design the user interface for your application, Delphi generates the
underlying Object Pascal code to support the application. As you select and modify
the properties of components and forms, the results of those changes appear
automatically in the source code, and vice versa. You can modify the source files
directly with any text editor, including the built-in Code editor. The changes you
make are immediately reflected in the visual environment as well.

Creating projects
All of Delphi’s application development revolves around projects. When you create
an application in Delphi you are creating a project. A project is a collection of files
that make up an application. Some of these files are created at design time. Others are
generated automatically when you compile the project source code.
You can view the contents of a project in a project management tool called the Project
Manager. The Project Manager lists, in a hierarchical view, the unit names, the forms
contained in the unit (if there is one), and shows the paths to the files in the project.
Although you can edit many of these files directly, it is often easier and more reliable
to use the visual tools in Delphi.
At the top of the project hierarchy, is a group file. You can combine multiple projects
into a project group. This allows you to open more than one project at a time in the
Project Manager. Project groups let you organize and work on related projects, such
as applications that function together or parts of a multi-tiered application. If you are
only working on one project, you do not need a project group file to create an
application.
Project files, which describe individual projects, files, and associated options, have a
.dpr extension. Project files contain directions for building an application or shared
object. When you add and remove files using the Project Manager, the project file is
updated. You specify project options using a Project Options dialog which has tabs
for various aspects of your project such as forms, application, compiler. These project
options are stored in the project file with the project.
Units and forms are the basic building blocks of a Delphi application. A project can
share any existing form and unit file including those that reside outside the project
directory tree. This includes custom procedures and functions that have been written
as standalone routines.
If you add a shared file to a project, realize that the file is not copied into the current
project directory; it remains in its current location. Adding the shared file to the
current project registers the file name and path in the uses clause of the project file.
Delphi automatically handles this as you add units to a project.
When you compile a project, it does not matter where the files that make up the
project reside. The compiler treats shared files the same as those created by the
project itself.

Developing applications with Delphi 2-3


Developing applications

Editing code
The Delphi Code editor is a full-featured ASCII editor. If using the visual
programming environment, a form is automatically displayed as part of a new
project. You can start designing your application interface by placing objects on the
form and modifying how they work in the Object Inspector. But other programming
tasks, such as writing event handlers for objects, must be done by typing the code.
The contents of the form, all of its properties, its components, and their properties
can be viewed and edited as text in the Code editor. You can adjust the generated
code in the Code editor and add more components within the editor by typing code.
As you type code into the editor, the compiler is constantly scanning for changed and
updating the form with the new layout. You can then go back to the form, view and
test the changes you made in the editor and continue adjusting the form from there.
The Delphi code generation and property streaming systems are completely open to
inspection. The source code for everything that is included in your final executable
file—all of the VCL objects, CLX objects, RTL sources, all of the Delphi project files
can be viewed and edited in the Code editor.

Compiling applications
When you have finished designing your application interface on the form, writing
additional code so it does what you want, you can compile the project from the IDE
or from the command line.
All projects have as a target a single distributable executable file. You can view or test
your application at various stages of development by compiling, building, or
running it:
• When you compile, only units that have changed since the last compile are
recompiled.
• When you build, all units in the project are compiled, regardless of whether or not
they have changed since the last compile. This technique is useful when you are
unsure of exactly which files have or have not been changed, or when you simply
want to ensure that all files are current and synchronized. It's also important to use
Build when you've changed global compiler directives, to ensure that all code
compiles in the proper state. You can also test the validity of your source code
without attempting to compile the project.
• When you run, you compile and then execute your application. If you modified
the source code since the last compilation, the compiler recompiles those changed
modules and relinks your application.
If you have grouped several projects together, you can compile or build all projects in
a single project group at once. Choose Project|Compile All Projects or Project|Build
All Projects with the project group selected in the Project Manager.

2-4 Developer’s Guide


Developing applications

Debugging applications
Delphi provides an integrated debugger that helps you find and fix errors in your
applications. The integrated debugger lets you control program execution, monitor
variable values and items in data structures, and modify data values while
debugging.
The integrated debugger can track down both runtime errors and logic errors. By
running to specific program locations and viewing the values of variables, the
functions on the call stack, and the program output, you can monitor how your
program behaves and find the areas where it is not behaving as designed. The
debugger is described in online Help.
You can also use exception handling to recognize, locate, and deal with errors.
Exceptions in Delphi are classes, like other classes in Delphi, except, by convention,
they begin with an E rather than the initial T for other classes.

Deploying applications
Delphi includes add-on tools to help with application deployment. For example,
InstallShield Express (not available in all versions) helps you to create an installation
package for your application that includes all of the files needed for running a
distributed application. Refer to Chapter 13, “Deploying applications” for specific
information on deployment.
Note Not all versions of Delphi have deployment capabilities.
TeamSource software (not available in all versions) is also available for tracking
application updates.

Developing applications with Delphi 2-5


2-6 Developer’s Guide
Chapter

Using the component libraries


Chapter 3
3
This chapter presents an overview of the component libraries and introduces some of
the components that you can use while developing applications. Delphi includes
both the Visual Component Library (VCL) and the Borland Component Library for
Cross-Platform (CLX). The VCL is for Windows development and CLX is for cross-
platform development on Windows and Linux. They are two different class libraries
but they have many similarities. Objects, properties, methods, and events that are not
in CLX are marked “VCL only.”

Understanding the component libraries


VCL and CLX are class libraries made up of objects, some of which are also
components or controls, that you use when developing applications. Both libraries
look very similar and contain many of the same objects. Some objects in the VCL
implement features that are available on Windows only such as objects that appear
on the ADO, BDE, QReport, COM+, Web Services, and Servers tabs on the
Component palette. Virtually all CLX objects are available on both Windows and
Linux.
VCL and CLX objects are active entities that contain all necessary data and the
“methods” (code) that modify the data. The data is stored in the fields and properties
of the objects, and the code is made up of methods that act upon the field and
property values. Each object is declared as a “class.” All VCL and CLX objects
descend from the ancestor object TObject including objects that you develop in Object
Pascal.
A subset of objects are components. Components are objects that you can place on a
form or data module and manipulate at design time. Components appear on the
Component palette. You can specify their properties without writing code. All VCL
or CLX components descend from the TComponent object.

Using the component libraries 3-1


Understanding the component libraries

Components are objects in the true object-oriented programming (OOP) sense


because they
• Encapsulate a set of data and data-access functions
• Inherit data and behavior from the objects they are derived from
• Operate interchangeably with other objects derived from a common ancestor,
through a concept called polymorphism
Unlike most components, objects do not appear on the Component palette. Instead, a
default instance variable is declared in the unit of the object, or you have to declare
one yourself.
Controls are a special kind of component that is visible to users at runtime. Controls
are a subset of components. Controls are visual components that you can see when
your application is running. All controls have properties in common that specify
their visual attributes, such as Height and Width. The properties, methods, and events
that all controls have in common are inherited from TControl.
Refer to Chapter 10, “Using CLX for cross-platform development” for details about
cross-platform programming and the differences between the Windows and Linux
environments. Detailed reference material on all of the objects in the VCL or CLX is
accessible using online Help while you are programming. From within the code
editor, place the cursor anywhere on the object and press F1 to display help on VCL
or CLX components.
If you are using Kylix while developing cross-platform applications, Kylix also
includes a Developer’s Guide that is tailored for the Linux environment. You can refer
to the manual both in the Kylix online Help or the printed manual provided with the
Kylix product.

Properties, methods, and events


Both the VCL and CLX form hierarchies of objects that are tied to the Delphi IDE,
where you can develop applications quickly. The objects in both component libraries
are based on properties, methods, and events. Each object includes data members
(properties), functions that operate on the data (methods), and a way to interact with
users of the class (events). The VCL is written in Object Pascal, whereas CLX is based
on Qt, a C++ class library.

Properties
Properties are characteristics of an object that influence either the visible behavior or
the operations of the object. For example, the Visible property determines whether an
object can be seen or not in an application interface. Well-designed properties make
your components easier for others to use and easier for you to maintain.
Here are some of the useful features of properties:
• Unlike methods, which are only available at runtime, you can see and change
properties at design time and get immediate feedback as the components change
in the IDE.

3-2 Developer’s Guide


Understanding the component libraries

• Properties can be accessed in the Object Inspector where you can modify the
values of your object visually. Setting properties at design time is easier than
writing code and makes your code easier to maintain.
• Because the data is encapsulated, it is protected and private to the actual object.
• The actual calls to get and set the values are methods, so special processing can be
done that is invisible to the user of the object. For example, data could reside in a
table, but could appear as a normal data member to the programmer.
• You can implement logic that triggers events or modifies other data during the
access of the property. For example, changing the value of one property may
require the modification of another. You can make the change in the methods
created for the property.
• Properties can be virtual.
• A property is not restricted to a single object. Changing a one property on one
object could effect several objects. For example, setting the Checked property on a
radio button effects all of the radio buttons in the group.

Methods
A method is a procedure that is always associated with a class. Methods define the
behavior of an object. Class methods can access all the public, protected, and private
properties and data members of the class and are commonly referred to as member
functions.

Events
An event is an action or occurrence detected by a program. Most modern applications
are said to be event-driven, because they are designed to respond to events. In a
program, the programmer has no way of predicting the exact sequence of actions a
user will perform next. They may choose a menu item, click a button, or mark some
text. You can write code to handle the events you're interested in, rather than writing
code that always executes in the same restricted order.
Regardless of how an event is called, Delphi looks to see if you have written any code
to handle that event. If you have, that code is executed; otherwise, the default event
handling behavior takes place.
The kinds of events that can occur can be divided into two main categories:
• User events
• System events
Regardless of how the event was called, Delphi looks to see if you have assigned any
code to handle that event. If you have, then that code is executed; otherwise, nothing
is done.

User events
User events are actions that are initiated by the user. Examples of user events are
OnClick (the user clicked the mouse), OnKeyPress (the user pressed a key on the
keyboard), and OnDblClick (the user double-clicked a mouse button). These events
are always tied to a user's actions.

Using the component libraries 3-3


Object Pascal and the class libraries

System events
System events are events that the operating system fires for you. For example, the
OnTimer event (the Timer component issues one of these events whenever a
predefined interval has elapsed), the OnCreate event (the component is being
created), the OnPaint event (a component or window needs to be redrawn), and so
on. Usually, system events are not directly initiated by a user action.

Object Pascal and the class libraries


Object Pascal, a set of object-oriented extensions to standard Pascal, is the language
of Delphi. Using Delphi’s Component palette and Object Inspector, you can place
VCL or CLX components on forms and manipulate their properties without writing
code.
All objects descend from TObject, an abstract class whose methods encapsulate
fundamental behavior like construction, destruction, and message handling. TObject
is the immediate ancestor of many simple classes.
Components in the VCL or CLX descend from the abstract class TComponent.
Components are objects that you can manipulate on forms at design time. Visual
components—that is, components like TForm and TSpeedButton that appear on the
screen at runtime—are called controls, and they descend from TControl.
In addition to the visual components, the component libraries contain many
nonvisual objects. The IDE allows you to add many nonvisual components to your
programs by dropping them onto forms. For example, if you were writing an
application that connects to a database, you might place a TDataSource component on
a form. Although TDataSource is nonvisual, it is represented on the form by an icon
(which doesn’t appear at runtime). You can manipulate the properties and events of
TDataSource in the Object Inspector just as you would those of a visual control.
When you write classes of your own in Object Pascal, they should descend from
TObject in the class library that you plan to use. Use VCL if you’re writing a Windows
application or CLX if writing a cross-platform application. By deriving new classes
from the appropriate base class (or one of its descendants), you provide your classes
with essential functionality and ensure that they work with the other classes in the
class library.

Using the object model


Object-oriented programming is an extension of structured programming that
emphasizes code reuse and encapsulation of data with functionality. Once you create
an object (or, more formally, a class), you and other programmers can use it in
different applications, thus reducing development time and increasing productivity.
If you want to create new components and put them on the Component palette, see
Chapter 40, “Overview of component creation.”

3-4 Developer’s Guide


Object Pascal and the class libraries

What is an object?
An object, or class, is a data type that encapsulates data and operations on data in a
single unit. Before object-oriented programming, data and operations (functions)
were treated as separate elements.
You can begin to understand objects if you understand Object Pascal records or
structures in C. Records are made of up fields that contain data, where each field has
its own type. Records make it easy to refer to a collection of varied data elements.
Objects are also collections of data elements. But objects—unlike records—contain
procedures and functions that operate on their data. These procedures and functions
are called methods.
An object’s data elements are accessed through properties. The properties of VCL and
CLX objects have values that you can change at design time without writing code. If
you want a property value to change at runtime, you need to write only a small
amount of code.
The combination of data and functionality in a single unit is called encapsulation. In
addition to encapsulation, object-oriented programming is characterized by
inheritance and polymorphism. Inheritance means that objects derive functionality from
other objects (called ancestors); objects can modify their inherited behavior.
Polymorphism means that different objects derived from the same ancestor support
the same method and property interfaces, which often can be called interchangeably.

Examining a Delphi object


When you create a new project, Delphi displays a new form for you to customize. In
the Code editor, Delphi declares a new class type for the form and produces the code
that creates the new form instance. The code generated for a new Windows
application looks like this:
unit Unit1;
interface
uses Windows, Classes, Graphics, Forms, Controls, Dialogs;
type
TForm1 = class(TForm){ The type declaration of the form begins here }
private
{ Private declarations }
public
{ Public declarations }
end;{ The type declaration of the form ends here }
var
Form1: TForm1;
implementation{ Beginning of implementation part }
{$R *.DFM}
end.{ End of implementation part and unit}
The new class type is TForm1, and it is derived from type TForm, which is also a class.
A class is like a record in that they both contain data fields, but a class also contains
methods—code that acts on the object’s data. So far, TForm1 appears to contain no

Using the component libraries 3-5


Object Pascal and the class libraries

fields or methods, because you haven’t added to the form any components (the fields
of the new object) and you haven’t created any event handlers (the methods of the
new object). TForm1 does contain inherited fields and methods, even though you
don’t see them in the type declaration.
This variable declaration declares a variable named Form1 of the new type TForm1.
var
Form1: TForm1;
Form1 represents an instance, or object, of the class type TForm1. You can declare
more than one instance of a class type; you might want to do this, for example, to
create multiple child windows in a Multiple Document Interface (MDI) application.
Each instance maintains its own data, but all instances use the same code to execute
methods.
Although you haven’t added any components to the form or written any code, you
already have a complete Delphi application that you can compile and run. All it does
is display a blank form.
Suppose you add a button component to this form and write an OnClick event
handler that changes the color of the form when the user clicks the button. The result
might look like this:
Figure 3.1 A simple form

When the user clicks the button, the form’s color changes to green. This is the event-
handler code for the button’s OnClick event:
procedure TForm1.Button1Click(Sender: TObject);
begin
Form1.Color := clGreen;
end;
Objects can contain other objects as data fields. Each time you place a component on
a form, a new field appears in the form’s type declaration. If you create the
application described above and look at the code in the Code editor, this is what you
see:
unit Unit1;
interface
uses Windows, Classes, Graphics, Forms, Controls;

3-6 Developer’s Guide


Object Pascal and the class libraries

type
TForm1 = class(TForm)
Button1: TButton;{ New data field }
procedure Button1Click(Sender: TObject);{ New method declaration }
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);{ The code of the new method }
begin
Form1.Color := clGreen;
end;
end.
TForm1 has a Button1 field that corresponds to the button you added to the form.
TButton is a class type, so Button1 refers to an object.
All the event handlers you write in Delphi are methods of the form object. Each time
you create an event handler, a method is declared in the form object type. The
TForm1 type now contains a new method, the Button1Click procedure, declared
within the TForm1 type declaration. The code that implements the Button1Click
method appears in the implementation part of the unit.

Changing the name of a component


You should always use the Object Inspector to change the name of a component. For
example, suppose you want to change a form’s name from the default Form1 to a
more descriptive name, such as ColorBox. When you change the form’s Name
property in the Object Inspector, the new name is automatically reflected in the
form’s .dfm or .xfm file (which you usually don’t edit manually) and in the Object
Pascal source code that Delphi generates:
unit Unit1;
interface
uses Windows, Classes, Graphics, Forms, Controls;
type
TColorBox = class(TForm){ Changed from TForm1 to TColorBox }
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var

Using the component libraries 3-7


Object Pascal and the class libraries

ColorBox: TColorBox;{ Changed from Form1 to ColorBox }


implementation
{$R *.DFM}
procedure TColorBox.Button1Click(Sender: TObject);
begin
Form1.Color := clGreen;{ The reference to Form1 didn't change! }
end;
end.
Note that the code in the OnClick event handler for the button hasn’t changed.
Because you wrote the code, you have to update it yourself and correct any
references to the form:
procedure TColorBox.Button1Click(Sender: TObject);
begin
ColorBox.Color := clGreen;
end;

Inheriting data and code from an object


The TForm1 object described seems simple. TForm1 appears to contain one field
(Button1), one method (Button1Click), and no properties. Yet you can show, hide, or
resize of the form, add or delete standard border icons, and set up the form to
become part of a Multiple Document Interface (MDI) application. You can do these
things because the form has inherited all the properties and methods of the
component TForm. When you add a new form to your project, you start with TForm
and customize it by adding components, changing property values, and writing
event handlers. To customize any object, you first derive a new object from the
existing one; when you add a new form to your project, Delphi automatically derives
a new form from the TForm type:
TForm1 = class(TForm)
A derived object inherits all the properties, events, and methods of the object it
derives from. The derived object is called a descendant and the object it derives from is
called an ancestor. If you look up TForm in the online Help, you’ll see lists of its
properties, events, and methods, including the ones that TForm inherits from its
ancestors. An object can have only one immediate ancestor, but it can have many
direct descendants.

Scope and qualifiers


Scope determines the accessibility of an object’s fields, properties, and methods. All
members declared within an object are available to that object and its descendants.
Although a method’s implementation code appears outside of the object declaration,
the method is still within the scope of the object because it is declared within the
object’s declaration.

3-8 Developer’s Guide


Exploring the Variety of Random
Documents with Different Content
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like