SlideShare a Scribd company logo
Developers Guide Borland Delphi 7 For Windows
Borland Software Corporation download
https://ebookbell.com/product/developers-guide-borland-
delphi-7-for-windows-borland-software-corporation-36903922
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 7 For Windows Developers Guide Borland
https://ebookbell.com/product/delphi-7-for-windows-developers-guide-
borland-6773342
Borland Delphi 6 Developers Guide Steve Teixeira Xavier Pacheco
https://ebookbell.com/product/borland-delphi-6-developers-guide-steve-
teixeira-xavier-pacheco-6760318
Delphi 6 For Windows Developers Guide Borland
https://ebookbell.com/product/delphi-6-for-windows-developers-guide-
borland-6760192
Developers Guide Delphi 6 For Windows
https://ebookbell.com/product/developers-guide-delphi-6-for-
windows-1021628
Borland C Builder 6 Developers Guide 2nd Jarrod Hollingworth
https://ebookbell.com/product/borland-c-builder-6-developers-
guide-2nd-jarrod-hollingworth-983154
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
Developers Guide To Collections In Microsoft Net Calvin Janes
https://ebookbell.com/product/developers-guide-to-collections-in-
microsoft-net-calvin-janes-2371386
Developers Guide To Web Application Security Michael Cross
https://ebookbell.com/product/developers-guide-to-web-application-
security-michael-cross-4099920
Developers Guide Borland Delphi 7 For Windows Borland Software Corporation
Developer’sGuide
Borland Software Corporation
100 Enterprise Way, Scotts Valley, CA 95066-3249
www.borland.com
Borland®
Delphi™
7
for Windows®
Refer to the DEPLOY document located in the root directory of your Delphi 7 product for a complete list of files that
you can distribute in accordance with the Delphi 7 License Statement and Limited Warranty.
Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this
document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of
this document does not give you any license to these patents.
COPYRIGHT © 1983–2002 Borland Software Corporation. All rights reserved. All Borland brand and product names
are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries.
All other marks are the property of their respective owners.
Printed in the U.S.A.
HDE1370WW21001 7E5R0802
0203040506-9 8 7 6 5 4 3 2 1
D3
iii
Chapter 1
Introduction 1-1
What’s in this manual? . . . . . . . . . . . . . . 1-1
Manual conventions . . . . . . . . . . . . . . . . 1-2
Developer support services. . . . . . . . . . . . 1-3
Part I
Programming with Delphi
Chapter 2
Developing applications with Delphi 2-1
Integrated development environment. . . . . . 2-1
Designing applications . . . . . . . . . . . . . . 2-2
Creating projects . . . . . . . . . . . . . . . . . . 2-3
Editing code . . . . . . . . . . . . . . . . . . . . 2-4
Compiling applications . . . . . . . . . . . . . . 2-4
Debugging applications. . . . . . . . . . . . . . 2-5
Deploying applications . . . . . . . . . . . . . . 2-5
Chapter 3
Using the component library 3-1
Understanding the component library . . . . . 3-1
Properties, methods, and events . . . . . . . 3-3
Properties . . . . . . . . . . . . . . . . . . 3-3
Methods . . . . . . . . . . . . . . . . . . . 3-4
Events . . . . . . . . . . . . . . . . . . . . 3-4
User events . . . . . . . . . . . . . . . . . 3-4
System events . . . . . . . . . . . . . . . . 3-4
Internal events . . . . . . . . . . . . . . . 3-4
Objects, components, and controls. . . . . . . . 3-5
TObject branch . . . . . . . . . . . . . . . . . 3-6
TPersistent branch . . . . . . . . . . . . . . . 3-7
TComponent branch . . . . . . . . . . . . . . 3-7
TControl branch . . . . . . . . . . . . . . . . 3-9
TWinControl/TWidgetControl branch . . .3-10
Chapter 4
Using the object model 4-1
What is an object? . . . . . . . . . . . . . . . . . 4-1
Examining a Delphi object . . . . . . . . . . 4-2
Changing the name of a component . . . . . 4-4
Inheriting data and code from an object. . . . . 4-5
Scope and qualifiers . . . . . . . . . . . . . . . . 4-5
Private, protected, public, and published
declarations . . . . . . . . . . . . . . . . . . 4-6
Using object variables . . . . . . . . . . . . . . . 4-7
Creating, instantiating, and destroying
objects . . . . . . . . . . . . . . . . . . . . . . . 4-8
Components and ownership . . . . . . . . . . 4-9
Defining new classes . . . . . . . . . . . . . . . . 4-9
Using interfaces . . . . . . . . . . . . . . . . . . 4-12
Using interfaces across the hierarchy . . . . 4-13
Using interfaces with procedures . . . . . . 4-14
Implementing IInterface . . . . . . . . . . . 4-14
TInterfacedObject . . . . . . . . . . . . . . . 4-15
Using the as operator with interfaces . . . . 4-16
Reusing code and delegation. . . . . . . . . 4-16
Using implements for delegation . . . . 4-17
Aggregation . . . . . . . . . . . . . . . . 4-18
Memory management of interface
objects. . . . . . . . . . . . . . . . . . . . . 4-18
Using reference counting . . . . . . . . . 4-19
Not using reference counting. . . . . . . 4-20
Using interfaces in distributed
applications . . . . . . . . . . . . . . . . . 4-21
Chapter 5
Using BaseCLX 5-1
Using streams . . . . . . . . . . . . . . . . . . . . 5-2
Using streams to read or write data . . . . . . 5-2
Stream methods for reading and
writing. . . . . . . . . . . . . . . . . . . . 5-2
Reading and writing components . . . . . 5-3
Reading and writing strings . . . . . . . . 5-3
Copying data from one stream to
another . . . . . . . . . . . . . . . . . . . . . 5-4
Specifying the stream position and size. . . . 5-4
Seeking to a specific position . . . . . . . . 5-4
Using Position and Size properties . . . . 5-5
Working with files . . . . . . . . . . . . . . . . . 5-5
Approaches to file I/O . . . . . . . . . . . . . 5-6
Using file streams . . . . . . . . . . . . . . . . 5-6
Creating and opening files using
file streams . . . . . . . . . . . . . . . . . 5-7
Using the file handle . . . . . . . . . . . . 5-8
Manipulating files. . . . . . . . . . . . . . . . 5-8
Deleting a file. . . . . . . . . . . . . . . . . 5-8
Finding a file . . . . . . . . . . . . . . . . . 5-8
Renaming a file. . . . . . . . . . . . . . . 5-10
File date-time routines . . . . . . . . . . 5-10
Copying a file . . . . . . . . . . . . . . . 5-11
Contents
iv
Working with ini files and the system
Registry . . . . . . . . . . . . . . . . . . . . . . 5-11
Using TIniFile and TMemIniFile . . . . .5-12
Using TRegistryIniFile . . . . . . . . . . .5-13
Using TRegistry. . . . . . . . . . . . . . .5-13
Working with lists . . . . . . . . . . . . . . . . .5-14
Common list operations . . . . . . . . . . . .5-15
Adding list items . . . . . . . . . . . . . .5-15
Deleting list items. . . . . . . . . . . . . .5-15
Accessing list items . . . . . . . . . . . . .5-16
Rearranging list items . . . . . . . . . . .5-16
Persistent lists. . . . . . . . . . . . . . . . . .5-16
Working with string lists . . . . . . . . . . . . .5-17
Loading and saving string lists . . . . . . . .5-17
Creating a new string list . . . . . . . . . . .5-18
Short-term string lists . . . . . . . . . . .5-18
Long-term string lists. . . . . . . . . . . .5-18
Manipulating strings in a list . . . . . . . . .5-20
Counting the strings in a list. . . . . . . .5-20
Accessing a particular string . . . . . . .5-20
Locating items in a string list . . . . . . .5-20
Iterating through strings in a list . . . . .5-20
Adding a string to a list . . . . . . . . . .5-21
Moving a string within a list. . . . . . . .5-21
Deleting a string from a list . . . . . . . .5-21
Associating objects with a string list . . .5-22
Working with strings . . . . . . . . . . . . . . .5-22
Wide character routines . . . . . . . . . . . .5-22
Commonly used long string routines . . . .5-23
Commonly used routines for
null-terminated strings. . . . . . . . . . . .5-26
Declaring and initializing strings. . . . . . .5-27
Mixing and converting string types . . . . .5-28
String to PChar conversions. . . . . . . . . .5-28
String dependencies . . . . . . . . . . . .5-29
Returning a PChar local variable . . . . .5-29
Passing a local variable as a PChar . . . .5-29
Compiler directives for strings . . . . . . . .5-30
Creating drawing spaces . . . . . . . . . . . . .5-31
Printing . . . . . . . . . . . . . . . . . . . . . . .5-32
Converting measurements . . . . . . . . . . . .5-33
Performing conversions . . . . . . . . . . . .5-33
Performing simple conversions . . . . . .5-33
Performing complex conversions . . . . .5-33
Adding new measurement types . . . . . . .5-34
Creating a simple conversion family
and adding units . . . . . . . . . . . . . . .5-34
Declare variables . . . . . . . . . . . . . .5-35
Register the conversion family . . . . . .5-35
Register measurement units . . . . . . . 5-35
Use the new units . . . . . . . . . . . . . 5-35
Using a conversion function . . . . . . . . . 5-36
Declare variables. . . . . . . . . . . . . . 5-36
Register the conversion family . . . . . . 5-36
Register the base unit . . . . . . . . . . . 5-36
Write methods to convert to and
from the base unit . . . . . . . . . . . . 5-36
Register the other units . . . . . . . . . . 5-37
Use the new units . . . . . . . . . . . . . 5-37
Using a class to manage conversions . . . . 5-37
Creating the conversion class. . . . . . . 5-38
Declare variables. . . . . . . . . . . . . . 5-39
Register the conversion family and
the other units . . . . . . . . . . . . . . 5-39
Use the new units . . . . . . . . . . . . . 5-40
Defining custom variants . . . . . . . . . . . . 5-40
Storing a custom variant type’s data . . . . 5-41
Creating a class to enable the custom
variant type. . . . . . . . . . . . . . . . . . 5-42
Enabling casting . . . . . . . . . . . . . . 5-42
Implementing binary operations. . . . . 5-44
Implementing comparison
operations. . . . . . . . . . . . . . . . . 5-46
Implementing unary operations . . . . . 5-47
Copying and clearing custom variants . . . 5-48
Loading and saving custom
variant values. . . . . . . . . . . . . . . 5-49
Using the TCustomVariantType
descendant . . . . . . . . . . . . . . . . 5-50
Writing utilities to work with a custom
variant type. . . . . . . . . . . . . . . . . . 5-50
Supporting properties and methods
in custom variants . . . . . . . . . . . . . . 5-51
Using TInvokeableVariantType . . . . . 5-51
Using TPublishableVariantType . . . . . 5-53
Chapter 6
Working with components 6-1
Setting component properties . . . . . . . . . . . 6-2
Setting properties at design time . . . . . . . 6-2
Using property editors . . . . . . . . . . . 6-3
Setting properties at runtime. . . . . . . . . . 6-3
Calling methods. . . . . . . . . . . . . . . . . . . 6-3
Working with events and event handlers . . . . 6-3
Generating a new event handler. . . . . . . . 6-4
Generating a handler for a component’s
default event . . . . . . . . . . . . . . . . . . 6-4
Locating event handlers . . . . . . . . . . . . 6-4
v
Associating an event with an existing event
handler. . . . . . . . . . . . . . . . . . . . . 6-5
Using the Sender parameter . . . . . . . . 6-5
Displaying and coding shared events . . 6-5
Associating menu events with event
handlers . . . . . . . . . . . . . . . . . . . . 6-6
Deleting event handlers . . . . . . . . . . . . 6-6
Cross-platform and non-cross-platform
components . . . . . . . . . . . . . . . . . . . . 6-7
Adding custom components to the
Component palette . . . . . . . . . . . . . . 6-9
Chapter 7
Working with controls 7-1
Implementing drag and drop in controls . . . . 7-1
Starting a drag operation . . . . . . . . . . . 7-1
Accepting dragged items . . . . . . . . . . . 7-2
Dropping items . . . . . . . . . . . . . . . . . 7-3
Ending a drag operation. . . . . . . . . . . . 7-3
Customizing drag and drop with
a drag object. . . . . . . . . . . . . . . . . . 7-3
Changing the drag mouse pointer . . . . . . 7-4
Implementing drag and dock in controls . . . . 7-4
Making a windowed control a
docking site . . . . . . . . . . . . . . . . . . 7-4
Making a control a dockable child . . . . . . 7-5
Controlling how child controls
are docked. . . . . . . . . . . . . . . . . . . 7-5
Controlling how child controls
are undocked . . . . . . . . . . . . . . . . . 7-6
Controlling how child controls respond
to drag-and-dock operations . . . . . . . . 7-6
Working with text in controls. . . . . . . . . . . 7-6
Setting text alignment . . . . . . . . . . . . . 7-7
Adding scroll bars at runtime. . . . . . . . . 7-7
Adding the clipboard object. . . . . . . . . . 7-8
Selecting text . . . . . . . . . . . . . . . . . . 7-9
Selecting all text . . . . . . . . . . . . . . . . 7-9
Cutting, copying, and pasting text . . . . . .7-10
Deleting selected text . . . . . . . . . . . . .7-10
Disabling menu items . . . . . . . . . . . . . 7-11
Providing a pop-up menu . . . . . . . . . . . 7-11
Handling the OnPopup event. . . . . . . . .7-12
Adding graphics to controls . . . . . . . . . . .7-13
Indicating that a control is
owner-drawn . . . . . . . . . . . . . . . . .7-13
Adding graphical objects to a string list . . 7-14
Adding images to an application . . . . 7-14
Adding images to a string list . . . . . . 7-14
Drawing owner-drawn items. . . . . . . 7-15
Sizing owner-draw items. . . . . . . . . . . 7-16
Drawing owner-draw items . . . . . . . . . 7-17
Chapter 8
Building applications, components, and
libraries 8-1
Creating applications. . . . . . . . . . . . . . . . 8-1
GUI applications. . . . . . . . . . . . . . . . . 8-2
User interface models . . . . . . . . . . . . 8-2
SDI applications . . . . . . . . . . . . . . . 8-2
MDI applications. . . . . . . . . . . . . . . 8-2
Setting IDE, project, and compiler
options . . . . . . . . . . . . . . . . . . . 8-3
Programming templates . . . . . . . . . . . . 8-3
Console applications . . . . . . . . . . . . . . 8-4
Service applications . . . . . . . . . . . . . . . 8-5
Service threads . . . . . . . . . . . . . . . . 8-7
Service name properties. . . . . . . . . . . 8-9
Debugging service applications . . . . . . 8-9
Creating packages and DLLs . . . . . . . . . . 8-10
When to use packages and DLLs . . . . . . 8-11
Writing database applications . . . . . . . . . . 8-11
Distributing database applications . . . . . 8-12
Creating Web server applications . . . . . . . . 8-12
Creating Web Broker applications . . . . . . 8-13
Creating WebSnap applications . . . . . . . 8-14
Creating Web Services applications . . . . . 8-14
Writing applications using COM . . . . . . . . 8-15
Using COM and DCOM . . . . . . . . . . . 8-15
Using MTS and COM+ . . . . . . . . . . . . 8-15
Using data modules . . . . . . . . . . . . . . . 8-16
Creating and editing standard
data modules. . . . . . . . . . . . . . . . . 8-16
Naming a data module and its
unit file . . . . . . . . . . . . . . . . . . 8-17
Placing and naming components . . . . 8-18
Using component properties and
events in a data module . . . . . . . . . 8-18
Creating business rules in a data
module . . . . . . . . . . . . . . . . . . 8-19
Accessing a data module from a form . . . 8-19
Adding a remote data module to an
application server project. . . . . . . . . . 8-20
vi
Using the Object Repository . . . . . . . . . . .8-20
Sharing items within a project . . . . . . . .8-20
Adding items to the Object Repository . . .8-21
Sharing objects in a team environment . . .8-21
Using an Object Repository item
in a project. . . . . . . . . . . . . . . . . . .8-21
Copying an item . . . . . . . . . . . . . .8-21
Inheriting an item. . . . . . . . . . . . . .8-22
Using an item . . . . . . . . . . . . . . . .8-22
Using project templates . . . . . . . . . . . .8-22
Modifying shared items . . . . . . . . . . . .8-22
Specifying a default project, new form,
and main form . . . . . . . . . . . . . . . .8-23
Enabling Help in applications . . . . . . . . . .8-23
Help system interfaces. . . . . . . . . . . . .8-24
Implementing ICustomHelpViewer . . . . .8-24
Communicating with the Help
Manager . . . . . . . . . . . . . . . . . . . .8-25
Asking the Help Manager for
information . . . . . . . . . . . . . . . . . .8-25
Displaying keyword-based Help . . . . . . .8-26
Displaying tables of contents . . . . . . . . .8-27
Implementing IExtendedHelpViewer . . . .8-27
Implementing IHelpSelector . . . . . . . . .8-28
Registering Help system objects . . . . . . .8-29
Registering Help viewers . . . . . . . . .8-29
Registering Help selectors . . . . . . . . .8-29
Using Help in a VCL application. . . . . . . . .8-30
How TApplication processes VCL Help . . .8-30
How VCL controls process Help . . . . . . .8-30
Using Help in a CLX application. . . . . . . . .8-31
How TApplication processes CLX Help . . .8-31
How CLX controls process Help . . . . . . .8-31
Calling a Help system directly . . . . . . . . . .8-32
Using IHelpSystem . . . . . . . . . . . . . . . .8-32
Customizing the IDE Help system. . . . . . . .8-33
Chapter 9
Developing the application user
interface 9-1
Controlling application behavior. . . . . . . . . 9-1
Working at the application level . . . . . . . 9-2
Handling the screen . . . . . . . . . . . . . . 9-2
Setting up forms . . . . . . . . . . . . . . . . . . 9-3
Using the main form . . . . . . . . . . . . . . 9-3
Hiding the main form . . . . . . . . . . . . . 9-3
Adding forms . . . . . . . . . . . . . . . . . . 9-4
Linking forms . . . . . . . . . . . . . . . . 9-4
Avoiding circular unit references . . . . . 9-4
Managing layout . . . . . . . . . . . . . . . . 9-5
Using forms . . . . . . . . . . . . . . . . . . . . . 9-6
Controlling when forms reside
in memory . . . . . . . . . . . . . . . . . . . 9-6
Displaying an auto-created form. . . . . . 9-6
Creating forms dynamically . . . . . . . . 9-7
Creating modeless forms such
as windows . . . . . . . . . . . . . . . . . 9-8
Creating a form instance using a local
variable . . . . . . . . . . . . . . . . . . . 9-8
Passing additional arguments to forms . . . . 9-8
Retrieving data from forms. . . . . . . . . . . 9-9
Retrieving data from modeless forms . . . 9-9
Retrieving data from modal forms. . . . 9-11
Reusing components and groups of
components . . . . . . . . . . . . . . . . . . . 9-13
Creating and using component templates . . . 9-13
Working with frames . . . . . . . . . . . . . . . 9-14
Creating frames . . . . . . . . . . . . . . . . 9-14
Adding frames to the Component
palette. . . . . . . . . . . . . . . . . . . . . 9-15
Using and modifying frames. . . . . . . . . 9-15
Sharing frames. . . . . . . . . . . . . . . . . 9-16
Developing dialog boxes. . . . . . . . . . . . . 9-17
Using open dialog boxes . . . . . . . . . . . 9-17
Organizing actions for toolbars and
menus . . . . . . . . . . . . . . . . . . . . . . 9-18
What is an action? . . . . . . . . . . . . . . . 9-19
Setting up action bands. . . . . . . . . . . . 9-20
Creating toolbars and menus . . . . . . . . 9-20
Adding color, patterns, or pictures
to menus, buttons, and toolbars . . . . 9-22
Adding icons to menus and
toolbars . . . . . . . . . . . . . . . . . . 9-22
Selecting menu and toolbar styles . . . . 9-23
Creating dynamic menus . . . . . . . . . 9-24
Creating toolbars and menus that
users can customize . . . . . . . . . . . 9-24
Hiding unused items and categories
in action bands . . . . . . . . . . . . . . 9-24
Creating most recently used
(MRU) lists . . . . . . . . . . . . . . . . 9-25
vii
Using action lists . . . . . . . . . . . . . . . . . .9-26
Setting up action lists . . . . . . . . . . . . .9-26
What happens when an action fires . . . . .9-27
Responding with events . . . . . . . . . .9-27
How actions find their targets. . . . . . .9-29
Updating actions . . . . . . . . . . . . . . . .9-29
Predefined action classes . . . . . . . . . . .9-30
Writing action components . . . . . . . . . .9-31
Registering actions . . . . . . . . . . . . . . .9-31
Creating and managing menus. . . . . . . . . .9-32
Opening the Menu Designer . . . . . . . . .9-33
Building menus. . . . . . . . . . . . . . . . .9-34
Naming menus . . . . . . . . . . . . . . .9-34
Naming the menu items . . . . . . . . . .9-34
Adding, inserting, and deleting
menu items . . . . . . . . . . . . . . . .9-35
Adding separator bars . . . . . . . . . . .9-36
Specifying accelerator keys and
keyboard shortcuts . . . . . . . . . . . .9-36
Creating submenus. . . . . . . . . . . . . . .9-37
Creating submenus by demoting
existing menus . . . . . . . . . . . . . .9-37
Moving menu items . . . . . . . . . . . .9-38
Adding images to menu items . . . . . .9-38
Viewing the menu . . . . . . . . . . . . .9-39
Editing menu items in the Object
Inspector. . . . . . . . . . . . . . . . . . . .9-39
Using the Menu Designer context
menu . . . . . . . . . . . . . . . . . . . . . .9-40
Commands on the context menu . . . . .9-40
Switching between menus at
design time . . . . . . . . . . . . . . . .9-41
Using menu templates . . . . . . . . . . . . .9-41
Saving a menu as a template . . . . . . . . .9-43
Naming conventions for template
menu items and event handlers . . . . .9-44
Manipulating menu items at runtime . . . .9-44
Merging menus . . . . . . . . . . . . . . . . .9-44
Specifying the active menu: Menu
property . . . . . . . . . . . . . . . . . .9-45
Determining the order of merged
menu items: GroupIndex property . . .9-45
Importing resource files . . . . . . . . . . . .9-45
Designing toolbars and cool bars . . . . . . . .9-46
Adding a toolbar using a panel
component. . . . . . . . . . . . . . . . . . .9-47
Adding a speed button to a panel. . . . .9-47
Assigning a speed button’s glyph. . . . .9-48
Setting the initial condition of a
speed button . . . . . . . . . . . . . . . 9-48
Creating a group of speed buttons. . . . 9-48
Allowing toggle buttons . . . . . . . . . 9-49
Adding a toolbar using the toolbar
component . . . . . . . . . . . . . . . . . . 9-49
Adding a tool button . . . . . . . . . . . 9-49
Assigning images to tool buttons . . . . 9-50
Setting tool button appearance
and initial conditions . . . . . . . . . . 9-50
Creating groups of tool buttons . . . . . 9-51
Allowing toggled tool buttons . . . . . . 9-51
Adding a cool bar component . . . . . . . . 9-51
Setting the appearance of the
cool bar . . . . . . . . . . . . . . . . . . 9-52
Responding to clicks . . . . . . . . . . . . . 9-52
Assigning a menu to a tool button. . . . 9-52
Adding hidden toolbars . . . . . . . . . . . 9-53
Hiding and showing toolbars . . . . . . . . 9-53
Demo programs . . . . . . . . . . . . . . . . 9-53
Common controls and XP themes. . . . . . . . 9-54
Chapter 10
Types of controls 10-1
Text controls . . . . . . . . . . . . . . . . . . . . 10-1
Edit controls . . . . . . . . . . . . . . . . . . 10-2
Edit control properties . . . . . . . . . . 10-2
Memo and rich edit controls . . . . . . . 10-3
Text viewing controls . . . . . . . . . . . . . 10-3
Labels . . . . . . . . . . . . . . . . . . . . . . 10-4
Specialized input controls . . . . . . . . . . . . 10-5
Scroll bars . . . . . . . . . . . . . . . . . . . 10-5
Track bars. . . . . . . . . . . . . . . . . . . . 10-5
Up-down controls . . . . . . . . . . . . . . . 10-6
Spin edit controls (CLX only) . . . . . . . . 10-6
Hot key controls (VCL only) . . . . . . . . . 10-6
Splitter controls . . . . . . . . . . . . . . . . 10-7
Buttons and similar controls. . . . . . . . . . . 10-7
Button controls. . . . . . . . . . . . . . . . . 10-8
Bitmap buttons . . . . . . . . . . . . . . . . 10-8
Speed buttons . . . . . . . . . . . . . . . . . 10-8
Check boxes . . . . . . . . . . . . . . . . . . 10-9
Radio buttons . . . . . . . . . . . . . . . . . 10-9
Toolbars. . . . . . . . . . . . . . . . . . . . . 10-9
Cool bars (VCL only) . . . . . . . . . . . . 10-10
List controls . . . . . . . . . . . . . . . . . . . 10-10
List boxes and check-list boxes . . . . . . .10-11
Combo boxes. . . . . . . . . . . . . . . . . .10-11
Tree views . . . . . . . . . . . . . . . . . . 10-12
viii
List views . . . . . . . . . . . . . . . . . . . 10-13
Icon views (CLX only) . . . . . . . . . . . . 10-13
Date-time pickers and month
calendars. . . . . . . . . . . . . . . . . . . 10-13
Grouping controls . . . . . . . . . . . . . . . . 10-13
Group boxes and radio groups . . . . . . . 10-14
Panels . . . . . . . . . . . . . . . . . . . . . 10-14
Scroll boxes . . . . . . . . . . . . . . . . . . 10-14
Tab controls . . . . . . . . . . . . . . . . . . 10-15
Page controls . . . . . . . . . . . . . . . . . 10-15
Header controls. . . . . . . . . . . . . . . . 10-15
Display controls . . . . . . . . . . . . . . . . . 10-16
Status bars. . . . . . . . . . . . . . . . . . . 10-16
Progress bars . . . . . . . . . . . . . . . . . 10-16
Help and hint properties . . . . . . . . . . 10-17
Grids. . . . . . . . . . . . . . . . . . . . . . . . 10-17
Draw grids . . . . . . . . . . . . . . . . . . 10-17
String grids . . . . . . . . . . . . . . . . . . 10-17
Value list editors (VCL only) . . . . . . . . . . 10-18
Graphic controls . . . . . . . . . . . . . . . . . 10-19
Images . . . . . . . . . . . . . . . . . . . . . 10-19
Shapes . . . . . . . . . . . . . . . . . . . . . 10-19
Bevels . . . . . . . . . . . . . . . . . . . . . 10-19
Paint boxes . . . . . . . . . . . . . . . . . . 10-20
Animation control . . . . . . . . . . . . . . 10-20
Chapter 11
Designing classes and components with
ModelMaker 11-1
ModelMaker fundamentals. . . . . . . . . . . . 11-2
ModelMaker models . . . . . . . . . . . . . . 11-2
Using ModelMaker with the IDE. . . . . . . 11-2
Creating models . . . . . . . . . . . . . . . . 11-3
Using ModelMaker views. . . . . . . . . . . . . 11-4
Collections pane . . . . . . . . . . . . . . . . 11-5
Classes view . . . . . . . . . . . . . . . . . 11-5
Units view . . . . . . . . . . . . . . . . . . 11-5
Diagrams view . . . . . . . . . . . . . . . 11-6
Members pane . . . . . . . . . . . . . . . . . 11-7
Editors pane. . . . . . . . . . . . . . . . . . . 11-7
Implementation Editor . . . . . . . . . . . 11-7
Unit Code Editor . . . . . . . . . . . . . . 11-8
Diagram Editor . . . . . . . . . . . . . . . 11-9
Other Editors . . . . . . . . . . . . . . . . 11-9
For more information . . . . . . . . . . . . . . 11-10
Chapter 12
Working with graphics and
multimedia 12-1
Overview of graphics programming . . . . . . 12-1
Refreshing the screen . . . . . . . . . . . . . 12-2
Types of graphic objects . . . . . . . . . . . 12-3
Common properties and methods
of Canvas . . . . . . . . . . . . . . . . . . . 12-4
Using the properties of the Canvas
object . . . . . . . . . . . . . . . . . . . . . 12-5
Using pens . . . . . . . . . . . . . . . . . 12-5
Using brushes . . . . . . . . . . . . . . . 12-8
Reading and setting pixels . . . . . . . . 12-9
Using Canvas methods to draw
graphic objects . . . . . . . . . . . . . . . 12-10
Drawing lines and polylines . . . . . . 12-10
Drawing shapes . . . . . . . . . . . . . .12-11
Handling multiple drawing objects
in your application . . . . . . . . . . . . 12-12
Keeping track of which drawing
tool to use . . . . . . . . . . . . . . . . 12-12
Changing the tool with speed
buttons . . . . . . . . . . . . . . . . . 12-13
Using drawing tools . . . . . . . . . . . 12-14
Drawing on a graphic. . . . . . . . . . . . 12-16
Making scrollable graphics . . . . . . . 12-17
Adding an image control . . . . . . . . 12-17
Loading and saving graphics files. . . . . 12-19
Loading a picture from a file . . . . . . 12-19
Saving a picture to a file. . . . . . . . . 12-20
Replacing the picture . . . . . . . . . . 12-20
Using the clipboard with graphics . . . . 12-21
Copying graphics to the clipboard. . . 12-22
Cutting graphics to the clipboard . . . 12-22
Pasting graphics from the
clipboard . . . . . . . . . . . . . . . . 12-23
Rubber banding example. . . . . . . . . . 12-24
Responding to the mouse . . . . . . . . 12-24
Responding to a mouse-down
action . . . . . . . . . . . . . . . . . . 12-25
Adding a field to a form object
to track mouse actions. . . . . . . . . 12-27
Refining line drawing . . . . . . . . . . 12-28
ix
Working with multimedia . . . . . . . . . . . 12-30
Adding silent video clips to an
application. . . . . . . . . . . . . . . . . . 12-30
Example of adding silent
video clips . . . . . . . . . . . . . . . . 12-31
Adding audio and/or video clips
to an application . . . . . . . . . . . . . . 12-32
Example of adding audio and/or
video clips (VCL only) . . . . . . . . . 12-33
Chapter 13
Writing multi-threaded applications 13-1
Defining thread objects . . . . . . . . . . . . . .13-2
Initializing the thread . . . . . . . . . . . . .13-3
Assigning a default priority . . . . . . . .13-3
Indicating when threads are freed . . . .13-4
Writing the thread function . . . . . . . . . .13-4
Using the main VCL/CLX thread. . . . .13-4
Using thread-local variables . . . . . . . .13-6
Checking for termination by
other threads. . . . . . . . . . . . . . . .13-6
Handling exceptions in the thread
function . . . . . . . . . . . . . . . . . .13-6
Writing clean-up code . . . . . . . . . . . . .13-7
Coordinating threads . . . . . . . . . . . . . . .13-7
Avoiding simultaneous access . . . . . . . .13-7
Locking objects . . . . . . . . . . . . . . .13-8
Using critical sections . . . . . . . . . . .13-8
Using the multi-read exclusive-write
synchronizer . . . . . . . . . . . . . . . .13-8
Other techniques for sharing
memory . . . . . . . . . . . . . . . . . .13-9
Waiting for other threads . . . . . . . . . . .13-9
Waiting for a thread to finish
executing. . . . . . . . . . . . . . . . . 13-10
Waiting for a task to be completed . . . 13-10
Executing thread objects . . . . . . . . . . . . 13-12
Overriding the default priority . . . . . . . 13-12
Starting and stopping threads . . . . . . . 13-12
Debugging multi-threaded applications . . . 13-13
Naming a thread . . . . . . . . . . . . . . . 13-13
Converting an unnamed thread to
a named thread . . . . . . . . . . . . . 13-13
Assigning separate names to
similar threads. . . . . . . . . . . . . . 13-15
Chapter 14
Exception handling 14-1
Defining protected blocks . . . . . . . . . . . . 14-2
Writing the try block . . . . . . . . . . . . . 14-2
Raising an exception. . . . . . . . . . . . 14-3
Writing exception handlers. . . . . . . . . . 14-4
Exception-handling statements . . . . . 14-4
Handling classes of exceptions. . . . . . 14-6
Scope of exception handlers . . . . . . . 14-6
Reraising exceptions. . . . . . . . . . . . 14-7
Writing finally blocks . . . . . . . . . . . . . 14-8
Writing a finally block. . . . . . . . . . . 14-9
Handling exceptions in VCL applications . . . 14-9
VCL exception classes . . . . . . . . . . . 14-10
Default exception handling in VCL . . . . .14-11
Silent exceptions. . . . . . . . . . . . . . . 14-12
Defining your own VCL exceptions. . . . 14-13
Chapter 15
Developing cross-platform
applications 15-1
Creating CLX applications . . . . . . . . . . . . 15-2
Porting VCL applications . . . . . . . . . . . . 15-2
Porting techniques . . . . . . . . . . . . . . 15-2
Platform-specific ports . . . . . . . . . . 15-3
Cross-platform ports . . . . . . . . . . . 15-3
Windows emulation ports . . . . . . . . 15-3
Modifying VCL applications. . . . . . . . . 15-4
WinCLX versus VisualCLX. . . . . . . . . . 15-5
What VisualCLX does differently . . . . 15-6
Features that do not port directly or
are missing . . . . . . . . . . . . . . . . . . 15-7
Comparing WinCLX and
VisualCLX units . . . . . . . . . . . . . . . 15-8
Differences in CLX object constructors . . .15-11
Handling system and widget events . . . 15-12
Writing portable code. . . . . . . . . . . . 15-12
Using conditional directives . . . . . . 15-13
Terminating conditional directives. . . 15-14
Including inline assembler code . . . . 15-15
Programming differences on Linux . . . . 15-16
x
Transferring applications between
Windows and Linux . . . . . . . . . . . . . . 15-17
Sharing source files between
Windows and Linux . . . . . . . . . . . . 15-17
Environmental differences between
Windows and Linux . . . . . . . . . . . . 15-18
Registry . . . . . . . . . . . . . . . . . . 15-20
Look and feel . . . . . . . . . . . . . . . 15-20
Directory structure on Linux . . . . . . . . 15-20
Cross-platform database applications . . . . . 15-21
dbExpress differences . . . . . . . . . . . . 15-22
Component-level differences . . . . . . . . 15-22
User interface-level differences . . . . . . . 15-23
Porting database applications to Linux . . 15-24
Updating data in dbExpress
applications . . . . . . . . . . . . . . . . . 15-26
Cross-platform Internet applications . . . . . 15-28
Porting Internet applications to Linux . . . 15-28
Chapter 16
Working with packages and
components 16-1
Why use packages? . . . . . . . . . . . . . . . .16-2
Packages and standard DLLs . . . . . . . . .16-2
Runtime packages . . . . . . . . . . . . . . . . .16-3
Loading packages in an application . . . . .16-3
Loading packages with the LoadPackage
function . . . . . . . . . . . . . . . . . .16-4
Deciding which runtime packages
to use. . . . . . . . . . . . . . . . . . . . . .16-4
Custom packages. . . . . . . . . . . . . . . .16-5
Design-time packages . . . . . . . . . . . . . . .16-5
Installing component packages . . . . . . . .16-6
Creating and editing packages . . . . . . . . . .16-7
Creating a package . . . . . . . . . . . . . . .16-7
Editing an existing package . . . . . . . . . .16-8
Understanding the structure
of a package . . . . . . . . . . . . . . . . . .16-8
Naming packages. . . . . . . . . . . . . .16-8
Requires clause . . . . . . . . . . . . . . .16-9
Contains clause . . . . . . . . . . . . . . .16-9
Editing package source files manually. . . 16-10
Compiling packages . . . . . . . . . . . . . 16-10
Package-specific compiler
directives. . . . . . . . . . . . . . . . . 16-11
Compiling and linking from
the command line . . . . . . . . . . . . 16-13
Package files created when
compiling . . . . . . . . . . . . . . . . 16-13
Deploying packages . . . . . . . . . . . . . . 16-14
Deploying applications that
use packages . . . . . . . . . . . . . . . . 16-14
Distributing packages to other
developers . . . . . . . . . . . . . . . . . 16-14
Package collection files . . . . . . . . . . . 16-14
Chapter 17
Creating international applications 17-1
Internationalization and localization . . . . . . 17-1
Internationalization . . . . . . . . . . . . . . 17-1
Localization . . . . . . . . . . . . . . . . . . 17-2
Internationalizing applications . . . . . . . . . 17-2
Enabling application code . . . . . . . . . . 17-2
Character sets . . . . . . . . . . . . . . . 17-2
OEM and ANSI character sets . . . . . . 17-3
Multibyte character sets. . . . . . . . . . 17-3
Wide characters . . . . . . . . . . . . . . 17-4
Including bi-directional functionality
in applications . . . . . . . . . . . . . . 17-4
BiDiMode property . . . . . . . . . . . . 17-4
Locale-specific features . . . . . . . . . . 17-7
Designing the user interface . . . . . . . . . 17-7
Text . . . . . . . . . . . . . . . . . . . . . 17-7
Graphic images . . . . . . . . . . . . . . 17-8
Formats and sort order . . . . . . . . . . 17-8
Keyboard mappings . . . . . . . . . . . . 17-8
Isolating resources. . . . . . . . . . . . . . . 17-8
Creating resource DLLs. . . . . . . . . . . . 17-9
Using resource DLLs . . . . . . . . . . . . 17-10
Dynamic switching of resource DLLs. . . .17-11
Localizing applications. . . . . . . . . . . . . 17-12
Localizing resources. . . . . . . . . . . . . 17-12
Chapter 18
Deploying applications 18-1
Deploying general applications . . . . . . . . . 18-1
Using installation programs . . . . . . . . . 18-2
Identifying application files . . . . . . . 18-2
Application files . . . . . . . . . . . . . . 18-3
Package files . . . . . . . . . . . . . . . . 18-3
Merge modules. . . . . . . . . . . . . . . 18-3
ActiveX controls . . . . . . . . . . . . . . 18-5
Helper applications . . . . . . . . . . . . 18-5
DLL locations. . . . . . . . . . . . . . . . 18-6
Deploying CLX applications. . . . . . . . . . . 18-6
xi
Deploying database applications. . . . . . . . .18-6
Deploying dbExpress database applications 18-7
Deploying BDE applications . . . . . . . . .18-8
Borland Database Engine . . . . . . . . .18-9
Deploying multi-tiered database applications
(DataSnap). . . . . . . . . . . . . . . . . . .18-9
Deploying Web applications . . . . . . . . . . .18-9
Deploying on Apache servers . . . . . . . 18-10
Enabling modules. . . . . . . . . . . . . 18-10
CGI applications . . . . . . . . . . . . . 18-11
Programming for varying host environments 18-12
Screen resolutions and color depths . . . . 18-12
Considerations when not dynamically
resizing . . . . . . . . . . . . . . . . . . 18-12
Considerations when dynamically resizing
forms and controls . . . . . . . . . . . 18-13
Accommodating varying color depths . 18-14
Fonts . . . . . . . . . . . . . . . . . . . . . . 18-14
Operating systems versions . . . . . . . . . 18-15
Software license requirements . . . . . . . . . 18-15
DEPLOY. . . . . . . . . . . . . . . . . . . . 18-15
README . . . . . . . . . . . . . . . . . . . 18-16
No-nonsense license agreement . . . . . . 18-16
Third-party product documentation . . . . 18-16
Part II
Developing database applications
Chapter 19
Designing database applications 19-1
Using databases . . . . . . . . . . . . . . . . . .19-1
Types of databases . . . . . . . . . . . . . . .19-2
Database security. . . . . . . . . . . . . . . .19-4
Transactions. . . . . . . . . . . . . . . . . . .19-4
Referential integrity, stored procedures,
and triggers . . . . . . . . . . . . . . . . . .19-5
Database architecture . . . . . . . . . . . . . . .19-6
General structure . . . . . . . . . . . . . . . .19-6
The user interface form. . . . . . . . . . .19-6
The data module . . . . . . . . . . . . . .19-6
Connecting directly to a database
server. . . . . . . . . . . . . . . . . . . . . .19-8
Using a dedicated file on disk. . . . . . . . .19-9
Connecting to another dataset . . . . . . . 19-10
Connecting a client dataset to another
dataset in the same application . . . . 19-12
Using a multi-tiered architecture . . . . 19-13
Combining approaches . . . . . . . . . . . 19-14
Designing the user interface . . . . . . . . . . 19-15
Analyzing data . . . . . . . . . . . . . . . 19-15
Writing reports. . . . . . . . . . . . . . . . 19-16
Chapter 20
Using data controls 20-1
Using common data control features . . . . . . 20-2
Associating a data control with
a dataset . . . . . . . . . . . . . . . . . . . 20-3
Changing the associated dataset
at runtime. . . . . . . . . . . . . . . . . 20-4
Enabling and disabling the data
source . . . . . . . . . . . . . . . . . . . 20-4
Responding to changes mediated
by the data source . . . . . . . . . . . . 20-4
Editing and updating data . . . . . . . . . . 20-5
Enabling editing in controls on
user entry . . . . . . . . . . . . . . . . . 20-5
Editing data in a control. . . . . . . . . . 20-5
Disabling and enabling data display . . . . 20-6
Refreshing data display. . . . . . . . . . . . 20-7
Enabling mouse, keyboard, and
timer events . . . . . . . . . . . . . . . . . 20-7
Choosing how to organize the data. . . . . . . 20-7
Displaying a single record . . . . . . . . . . 20-7
Displaying data as labels . . . . . . . . . 20-8
Displaying and editing fields in an
edit box . . . . . . . . . . . . . . . . . . 20-8
Displaying and editing text in a memo
control . . . . . . . . . . . . . . . . . . . 20-9
Displaying and editing text in a rich
edit memo control . . . . . . . . . . . . 20-9
Displaying and editing graphics fields
in an image control. . . . . . . . . . . 20-10
Displaying and editing data in list and
combo boxes . . . . . . . . . . . . . . 20-10
Handling Boolean field values with
check boxes . . . . . . . . . . . . . . . 20-13
Restricting field values with radio
controls . . . . . . . . . . . . . . . . . 20-14
Displaying multiple records . . . . . . . . 20-14
Viewing and editing data with TDBGrid. . . 20-15
Using a grid control in its default state . . 20-16
Creating a customized grid. . . . . . . . . 20-17
Understanding persistent columns . . 20-17
Creating persistent columns . . . . . . 20-18
Deleting persistent columns . . . . . . 20-19
Arranging the order of persistent
columns . . . . . . . . . . . . . . . . . 20-19
xii
Setting column properties at design
time . . . . . . . . . . . . . . . . . . . . 20-20
Defining a lookup list column. . . . . . 20-21
Putting a button in a column . . . . . . 20-22
Restoring default values to a
column . . . . . . . . . . . . . . . . . . 20-22
Displaying ADT and array fields . . . . . . 20-22
Setting grid options . . . . . . . . . . . . . 20-24
Editing in the grid . . . . . . . . . . . . . . 20-26
Controlling grid drawing . . . . . . . . . . 20-26
Responding to user actions at runtime. . . 20-27
Creating a grid that contains other
data-aware controls . . . . . . . . . . . . . . 20-28
Navigating and manipulating records. . . . . 20-29
Choosing navigator buttons
to display . . . . . . . . . . . . . . . . . . 20-30
Hiding and showing navigator
buttons at design time . . . . . . . . . 20-30
Hiding and showing navigator
buttons at runtime . . . . . . . . . . . 20-31
Displaying fly-over help. . . . . . . . . . . 20-31
Using a single navigator for multiple
datasets . . . . . . . . . . . . . . . . . . . 20-32
Chapter 21
Creating reports with Rave
Reports 21-1
Overview . . . . . . . . . . . . . . . . . . . . . .21-1
Getting started . . . . . . . . . . . . . . . . . . .21-2
The Rave Visual Designer. . . . . . . . . . . . .21-3
Component overview . . . . . . . . . . . . . . .21-4
VCL/CLX components . . . . . . . . . . . .21-4
Engine components. . . . . . . . . . . . .21-4
Render components . . . . . . . . . . . .21-4
Data connection components . . . . . . .21-4
Rave project component . . . . . . . . . .21-5
Reporting components. . . . . . . . . . . . .21-5
Project components. . . . . . . . . . . . .21-5
Data objects . . . . . . . . . . . . . . . . .21-5
Standard components . . . . . . . . . . .21-5
Drawing components . . . . . . . . . . .21-5
Report components. . . . . . . . . . . . .21-6
Bar code components. . . . . . . . . . . .21-6
Getting more information. . . . . . . . . . . . .21-6
Chapter 22
Using decision support
components 22-1
Overview . . . . . . . . . . . . . . . . . . . . . 22-1
About crosstabs . . . . . . . . . . . . . . . . . . 22-2
One-dimensional crosstabs. . . . . . . . . . 22-3
Multidimensional crosstabs . . . . . . . . . 22-3
Guidelines for using decision support
components . . . . . . . . . . . . . . . . . . . 22-4
Using datasets with decision support
components . . . . . . . . . . . . . . . . . . . 22-5
Creating decision datasets with TQuery
or TTable . . . . . . . . . . . . . . . . . . . 22-6
Creating decision datasets with the
Decision Query editor. . . . . . . . . . . . 22-6
Using decision cubes . . . . . . . . . . . . . . . 22-7
Decision cube properties and events . . . . 22-7
Using the Decision Cube editor . . . . . . . 22-8
Viewing and changing dimension
settings . . . . . . . . . . . . . . . . . . 22-8
Setting the maximum available
dimensions and summaries. . . . . . . 22-9
Viewing and changing design
options . . . . . . . . . . . . . . . . . . 22-9
Using decision sources . . . . . . . . . . . . . . 22-9
Properties and events . . . . . . . . . . . . . 22-9
Using decision pivots. . . . . . . . . . . . . . 22-10
Decision pivot properties. . . . . . . . . . 22-10
Creating and using decision grids . . . . . . .22-11
Creating decision grids . . . . . . . . . . . .22-11
Using decision grids . . . . . . . . . . . . .22-11
Opening and closing decision grid
fields. . . . . . . . . . . . . . . . . . . .22-11
Reorganizing rows and columns in
decision grids. . . . . . . . . . . . . . 22-12
Drilling down for detail in decision
grids . . . . . . . . . . . . . . . . . . . 22-12
Limiting dimension selection in
decision grids. . . . . . . . . . . . . . 22-12
Decision grid properties . . . . . . . . . . 22-12
Creating and using decision graphs . . . . . 22-13
Creating decision graphs . . . . . . . . . . 22-13
Using decision graphs . . . . . . . . . . . 22-14
The decision graph display. . . . . . . . . 22-15
Customizing decision graphs . . . . . . . 22-16
Setting decision graph template
defaults . . . . . . . . . . . . . . . . . 22-17
Customizing decision graph series . . 22-18
xiii
Decision support components at
runtime . . . . . . . . . . . . . . . . . . . . . 22-19
Decision pivots at runtime . . . . . . . . . 22-19
Decision grids at runtime . . . . . . . . . . 22-19
Decision graphs at runtime . . . . . . . . . 22-20
Decision support components and memory
control . . . . . . . . . . . . . . . . . . . . . . 22-20
Setting maximum dimensions,
summaries, and cells . . . . . . . . . . . . 22-20
Setting dimension state . . . . . . . . . . . 22-21
Using paged dimensions . . . . . . . . . . 22-21
Chapter 23
Connecting to databases 23-1
Using implicit connections . . . . . . . . . . . .23-2
Controlling connections. . . . . . . . . . . . . .23-3
Connecting to a database server . . . . . . .23-3
Disconnecting from a database server . . . .23-4
Controlling server login. . . . . . . . . . . . . .23-4
Managing transactions . . . . . . . . . . . . . .23-6
Starting a transaction . . . . . . . . . . . . .23-7
Ending a transaction . . . . . . . . . . . . . .23-8
Ending a successful transaction . . . . . .23-8
Ending an unsuccessful transaction . . .23-9
Specifying the transaction isolation
level . . . . . . . . . . . . . . . . . . . . . .23-9
Sending commands to the server . . . . . . . 23-10
Working with associated datasets . . . . . . . 23-12
Closing all datasets without
disconnecting from the server. . . . . . . 23-12
Iterating through the associated
datasets . . . . . . . . . . . . . . . . . . . 23-13
Obtaining metadata . . . . . . . . . . . . . . . 23-13
Listing available tables. . . . . . . . . . . . 23-14
Listing the fields in a table . . . . . . . . . 23-14
Listing available stored procedures . . . . 23-14
Listing available indexes . . . . . . . . . . 23-14
Listing stored procedure parameters. . . . 23-15
Chapter 24
Understanding datasets 24-1
Using TDataSet descendants . . . . . . . . . . .24-2
Determining dataset states . . . . . . . . . . . .24-3
Opening and closing datasets . . . . . . . . . .24-4
Navigating datasets . . . . . . . . . . . . . . . .24-5
Using the First and Last methods . . . . . .24-6
Using the Next and Prior methods . . . . . .24-7
Using the MoveBy method . . . . . . . . . .24-7
Using the Eof and Bof properties . . . . . . 24-8
Eof . . . . . . . . . . . . . . . . . . . . . . 24-8
Bof . . . . . . . . . . . . . . . . . . . . . . 24-9
Marking and returning to records . . . . . . 24-9
The Bookmark property. . . . . . . . . . 24-9
The GetBookmark method . . . . . . . 24-10
The GotoBookmark and
BookmarkValid methods . . . . . . . 24-10
The CompareBookmarks method . . . 24-10
The FreeBookmark method. . . . . . . 24-10
A bookmarking example . . . . . . . . 24-10
Searching datasets . . . . . . . . . . . . . . . .24-11
Using Locate . . . . . . . . . . . . . . . . . .24-11
Using Lookup . . . . . . . . . . . . . . . . 24-12
Displaying and editing a subset of data
using filters . . . . . . . . . . . . . . . . . . 24-13
Enabling and disabling filtering . . . . . . 24-13
Creating filters . . . . . . . . . . . . . . . . 24-13
Setting the Filter property. . . . . . . . 24-14
Writing an OnFilterRecord event
handler . . . . . . . . . . . . . . . . . 24-15
Switching filter event handlers at
runtime . . . . . . . . . . . . . . . . . 24-16
Setting filter options. . . . . . . . . . . . . 24-16
Navigating records in a filtered
dataset . . . . . . . . . . . . . . . . . . . 24-16
Modifying data . . . . . . . . . . . . . . . . . 24-17
Editing records. . . . . . . . . . . . . . . . 24-18
Adding new records . . . . . . . . . . . . 24-19
Inserting records . . . . . . . . . . . . . 24-19
Appending records . . . . . . . . . . . 24-20
Deleting records . . . . . . . . . . . . . . . 24-20
Posting data . . . . . . . . . . . . . . . . . 24-21
Canceling changes. . . . . . . . . . . . . . 24-21
Modifying entire records . . . . . . . . . . 24-22
Calculating fields . . . . . . . . . . . . . . . . 24-23
Types of datasets . . . . . . . . . . . . . . . . 24-24
Using table type datasets. . . . . . . . . . . . 24-25
Advantages of using table type
datasets . . . . . . . . . . . . . . . . . . . 24-26
Sorting records with indexes. . . . . . . . 24-26
Obtaining information about
indexes . . . . . . . . . . . . . . . . . 24-27
Specifying an index with
IndexName . . . . . . . . . . . . . . . 24-27
Creating an index with
IndexFieldNames . . . . . . . . . . . 24-28
xiv
Using Indexes to search for records . . . . 24-28
Executing a search with Goto
methods . . . . . . . . . . . . . . . . . 24-29
Executing a search with Find
methods . . . . . . . . . . . . . . . . . 24-30
Specifying the current record after a
successful search . . . . . . . . . . . . 24-30
Searching on partial keys . . . . . . . . 24-30
Repeating or extending a search . . . . 24-30
Limiting records with ranges . . . . . . . . 24-31
Understanding the differences
between ranges and filters . . . . . . . 24-31
Specifying ranges . . . . . . . . . . . . . 24-31
Modifying a range . . . . . . . . . . . . 24-34
Applying or canceling a range . . . . . 24-34
Creating master/detail relationships. . . . 24-35
Making the table a detail of another
dataset . . . . . . . . . . . . . . . . . . 24-35
Using nested detail tables . . . . . . . . 24-37
Controlling Read/write access to
tables . . . . . . . . . . . . . . . . . . . . . 24-38
Creating and deleting tables . . . . . . . . 24-38
Creating tables . . . . . . . . . . . . . . 24-38
Deleting tables . . . . . . . . . . . . . . 24-41
Emptying tables . . . . . . . . . . . . . . . 24-41
Synchronizing tables . . . . . . . . . . . . . 24-42
Using query-type datasets . . . . . . . . . . . 24-42
Specifying the query . . . . . . . . . . . . . 24-43
Specifying a query using the
SQL property . . . . . . . . . . . . . . 24-44
Specifying a query using the
CommandText property . . . . . . . . 24-44
Using parameters in queries . . . . . . . . 24-45
Supplying parameters at design
time . . . . . . . . . . . . . . . . . . . . 24-45
Supplying parameters at runtime. . . . 24-47
Establishing master/detail relationships
using parameters . . . . . . . . . . . . . . 24-47
Preparing queries. . . . . . . . . . . . . . . 24-48
Executing queries that don’t return a result set .
24-49
Using unidirectional result sets . . . . . . . 24-49
Using stored procedure-type datasets . . . . . 24-50
Working with stored procedure
parameters. . . . . . . . . . . . . . . . . . 24-51
Setting up parameters at design
time . . . . . . . . . . . . . . . . . . . . 24-52
Using parameters at runtime . . . . . . 24-54
Preparing stored procedures . . . . . . . . 24-55
Executing stored procedures that don’t
return a result set . . . . . . . . . . . . . 24-55
Fetching multiple result sets . . . . . . . . 24-56
Chapter 25
Working with field components 25-1
Dynamic field components . . . . . . . . . . . 25-2
Persistent field components . . . . . . . . . . . 25-3
Creating persistent fields . . . . . . . . . . . 25-4
Arranging persistent fields. . . . . . . . . . 25-5
Defining new persistent fields . . . . . . . . 25-5
Defining a data field. . . . . . . . . . . . 25-6
Defining a calculated field . . . . . . . . 25-7
Programming a calculated field . . . . . 25-8
Defining a lookup field . . . . . . . . . . 25-9
Defining an aggregate field. . . . . . . 25-10
Deleting persistent field components . . . .25-11
Setting persistent field properties
and events . . . . . . . . . . . . . . . . . .25-11
Setting display and edit properties
at design time. . . . . . . . . . . . . . .25-11
Setting field component properties
at runtime. . . . . . . . . . . . . . . . 25-13
Creating attribute sets for field
components. . . . . . . . . . . . . . . 25-13
Associating attribute sets with field
components. . . . . . . . . . . . . . . 25-14
Removing attribute associations . . . . 25-14
Controlling and masking user
input. . . . . . . . . . . . . . . . . . . 25-15
Using default formatting for numeric,
date, and time fields . . . . . . . . . . 25-15
Handling events . . . . . . . . . . . . . 25-16
Working with field component methods
at runtime . . . . . . . . . . . . . . . . . . . 25-17
Displaying, converting, and accessing
field values. . . . . . . . . . . . . . . . . . . 25-18
Displaying field component values in
standard controls . . . . . . . . . . . . . 25-18
Converting field values. . . . . . . . . . . 25-19
Accessing field values with the default
dataset property . . . . . . . . . . . . . . 25-20
Accessing field values with a dataset’s
Fields property. . . . . . . . . . . . . . . 25-21
Accessing field values with a dataset’s
FieldByName method. . . . . . . . . . . 25-21
Setting a default value for a field . . . . . . . 25-22
xv
Working with constraints . . . . . . . . . . . . 25-22
Creating a custom constraint . . . . . . . . 25-22
Using server constraints . . . . . . . . . . . 25-23
Using object fields . . . . . . . . . . . . . . . . 25-23
Displaying ADT and array fields . . . . . . 25-24
Working with ADT fields . . . . . . . . . . 25-25
Using persistent field components . . . 25-25
Using the dataset’s FieldByName
method . . . . . . . . . . . . . . . . . . 25-25
Using the dateset’s FieldValues
property . . . . . . . . . . . . . . . . . 25-25
Using the ADT field’s FieldValues
property . . . . . . . . . . . . . . . . . 25-26
Using the ADT field’s Fields
property . . . . . . . . . . . . . . . . . 25-26
Working with array fields . . . . . . . . . . 25-26
Using persistent fields . . . . . . . . . . 25-26
Using the array field’s FieldValues
property . . . . . . . . . . . . . . . . . 25-27
Using the array field’s Fields
property . . . . . . . . . . . . . . . . . 25-27
Working with dataset fields . . . . . . . . . 25-27
Displaying dataset fields. . . . . . . . . 25-27
Accessing data in a nested dataset . . . 25-28
Working with reference fields. . . . . . . . 25-28
Displaying reference fields . . . . . . . 25-28
Accessing data in a reference field . . . 25-29
Chapter 26
Using the Borland Database Engine 26-1
BDE-based architecture . . . . . . . . . . . . . .26-1
Using BDE-enabled datasets . . . . . . . . .26-2
Associating a dataset with database
and session connections . . . . . . . . .26-3
Caching BLOBs . . . . . . . . . . . . . . .26-4
Obtaining a BDE handle . . . . . . . . . .26-4
Using TTable . . . . . . . . . . . . . . . . . .26-5
Specifying the table type for local
tables . . . . . . . . . . . . . . . . . . . .26-5
Controlling read/write access to
local tables . . . . . . . . . . . . . . . . .26-6
Specifying a dBASE index file. . . . . . .26-6
Renaming local tables . . . . . . . . . . .26-8
Importing data from another table . . . .26-8
Using TQuery. . . . . . . . . . . . . . . . . .26-9
Creating heterogeneous queries. . . . . .26-9
Obtaining an editable result set . . . . . 26-10
Updating read-only result sets . . . . . 26-11
Using TStoredProc . . . . . . . . . . . . . .26-11
Binding parameters . . . . . . . . . . . 26-12
Working with Oracle overloaded
stored procedures . . . . . . . . . . . 26-12
Connecting to databases with
TDatabase . . . . . . . . . . . . . . . . . 26-12
Associating a database component
with a session. . . . . . . . . . . . . . 26-13
Understanding database and session
component interactions . . . . . . . . 26-13
Identifying the database . . . . . . . . 26-14
Opening a connection using
TDatabase. . . . . . . . . . . . . . . . 26-15
Using database components in
data modules . . . . . . . . . . . . . . 26-16
Managing database sessions . . . . . . . . 26-16
Activating a session . . . . . . . . . . . 26-18
Specifying default database
connection behavior . . . . . . . . . . 26-18
Managing database connections . . . . 26-19
Working with password-protected
Paradox and dBASE tables . . . . . . 26-21
Specifying Paradox directory
locations. . . . . . . . . . . . . . . . . 26-24
Working with BDE aliases . . . . . . . 26-25
Retrieving information about
a session. . . . . . . . . . . . . . . . . 26-27
Creating additional sessions . . . . . . 26-28
Naming a session . . . . . . . . . . . . 26-29
Managing multiple sessions . . . . . . 26-29
Using transactions with the BDE . . . . . . . 26-31
Using passthrough SQL . . . . . . . . . . 26-32
Using local transactions . . . . . . . . . . 26-32
Using the BDE to cache updates . . . . . . . 26-33
Enabling BDE-based cached updates . . . 26-34
Applying BDE-based cached updates. . . 26-35
Applying cached updates using
a database. . . . . . . . . . . . . . . . 26-36
Applying cached updates with
dataset component methods . . . . . 26-36
Creating an OnUpdateRecord event
handler . . . . . . . . . . . . . . . . . 26-37
Handling cached update errors . . . . 26-38
Using update objects to update
a dataset . . . . . . . . . . . . . . . . . . 26-40
Creating SQL statements for update
components. . . . . . . . . . . . . . . 26-41
Using multiple update objects . . . . . 26-45
Executing the SQL statements . . . . . 26-46
xvi
Using TBatchMove. . . . . . . . . . . . . . . . 26-49
Creating a batch move component . . . . . 26-49
Specifying a batch move mode . . . . . . . 26-50
Appending records . . . . . . . . . . . . 26-50
Updating records . . . . . . . . . . . . . 26-50
Appending and updating records . . . 26-51
Copying datasets . . . . . . . . . . . . . 26-51
Deleting records. . . . . . . . . . . . . . 26-51
Mapping data types . . . . . . . . . . . . . 26-51
Executing a batch move . . . . . . . . . . . 26-52
Handling batch move errors . . . . . . . . 26-52
The Data Dictionary . . . . . . . . . . . . . . . 26-53
Tools for working with the BDE . . . . . . . . 26-55
Chapter 27
Working with ADO components 27-1
Overview of ADO components . . . . . . . . .27-2
Connecting to ADO data stores . . . . . . . . .27-3
Connecting to a data store using
TADOConnection. . . . . . . . . . . . . . .27-3
Accessing the connection object. . . . . .27-5
Fine-tuning a connection . . . . . . . . . . .27-5
Forcing asynchronous connections . . . .27-5
Controlling time-outs. . . . . . . . . . . .27-6
Indicating the types of operations
the connection supports . . . . . . . . .27-6
Specifying whether the connection
automatically initiates transactions . . .27-7
Accessing the connection’s commands . . .27-7
ADO connection events . . . . . . . . . . . .27-8
Events when establishing a
connection . . . . . . . . . . . . . . . . .27-8
Events when disconnecting . . . . . . . .27-8
Events when managing transactions . . .27-9
Other events . . . . . . . . . . . . . . . . .27-9
Using ADO datasets . . . . . . . . . . . . . . . .27-9
Connecting an ADO dataset to a
data store . . . . . . . . . . . . . . . . 27-10
Working with record sets . . . . . . . . 27-11
Filtering records based on
bookmarks . . . . . . . . . . . . . . . . 27-11
Fetching records asynchronously . . . . 27-12
Using batch updates . . . . . . . . . . . 27-13
Loading data from and saving
data to files. . . . . . . . . . . . . . . . 27-15
Using TADODataSet . . . . . . . . . . . . . 27-16
Using Command objects . . . . . . . . . . . . 27-18
Specifying the command . . . . . . . . . . 27-18
Using the Execute method . . . . . . . . . 27-19
Canceling commands . . . . . . . . . . . . 27-19
Retrieving result sets with commands . . 27-20
Handling command parameters. . . . . . 27-20
Chapter 28
Using unidirectional datasets 28-1
Types of unidirectional datasets. . . . . . . . . 28-2
Connecting to the database server . . . . . . . 28-2
Setting up TSQLConnection . . . . . . . . . 28-3
Identifying the driver . . . . . . . . . . . 28-3
Specifying connection parameters . . . . 28-4
Naming a connection description . . . . 28-4
Using the Connection Editor . . . . . . . 28-5
Specifying what data to display. . . . . . . . . 28-6
Representing the results of a query . . . . . 28-6
Representing the records in a table . . . . . 28-7
Representing a table using
TSQLDataSet . . . . . . . . . . . . . . . 28-7
Representing a table using
TSQLTable . . . . . . . . . . . . . . . . 28-7
Representing the results of a stored
procedure. . . . . . . . . . . . . . . . . . . 28-8
Fetching the data . . . . . . . . . . . . . . . . . 28-8
Preparing the dataset . . . . . . . . . . . . . 28-9
Fetching multiple datasets . . . . . . . . . . 28-9
Executing commands that do not
return records . . . . . . . . . . . . . . . . . 28-10
Specifying the command to execute. . . . 28-10
Executing the command . . . . . . . . . . .28-11
Creating and modifying server
metadata . . . . . . . . . . . . . . . . . . .28-11
Setting up master/detail linked cursors . . . 28-12
Accessing schema information . . . . . . . . 28-13
Fetching metadata into a
unidirectional dataset . . . . . . . . . . 28-13
Fetching data after using the
dataset for metadata . . . . . . . . . . 28-14
The structure of metadata
datasets . . . . . . . . . . . . . . . . . 28-14
Debugging dbExpress applications . . . . . . 28-19
Using TSQLMonitor to monitor
SQL commands . . . . . . . . . . . . . . 28-19
Using a callback to monitor
SQL commands . . . . . . . . . . . . . . 28-20
xvii
Chapter 29
Using client datasets 29-1
Working with data using a client dataset . . . .29-2
Navigating data in client datasets . . . . . .29-2
Limiting what records appear. . . . . . . . .29-2
Editing data . . . . . . . . . . . . . . . . . . .29-5
Undoing changes . . . . . . . . . . . . . .29-5
Saving changes . . . . . . . . . . . . . . .29-6
Constraining data values . . . . . . . . . . .29-7
Specifying custom constraints. . . . . . .29-7
Sorting and indexing. . . . . . . . . . . . . .29-8
Adding a new index . . . . . . . . . . . .29-8
Deleting and switching indexes. . . . . .29-9
Using indexes to group data. . . . . . . .29-9
Representing calculated values . . . . . . . 29-10
Using internally calculated fields
in client datasets. . . . . . . . . . . . . 29-11
Using maintained aggregates . . . . . . . . 29-11
Specifying aggregates . . . . . . . . . . 29-12
Aggregating over groups
of records. . . . . . . . . . . . . . . . . 29-13
Obtaining aggregate values . . . . . . . 29-14
Copying data from another dataset . . . . 29-14
Assigning data directly. . . . . . . . . . 29-14
Cloning a client dataset cursor . . . . . 29-15
Adding application-specific information
to the data . . . . . . . . . . . . . . . . . . 29-15
Using a client dataset to cache updates . . . . 29-16
Overview of using cached updates. . . . . 29-17
Choosing the type of dataset for
caching updates. . . . . . . . . . . . . . . 29-18
Indicating what records are modified . . . 29-19
Updating records . . . . . . . . . . . . . . . 29-20
Applying updates. . . . . . . . . . . . . 29-20
Intervening as updates are applied . . . 29-21
Reconciling update errors . . . . . . . . 29-23
Using a client dataset with a provider. . . . . 29-24
Specifying a provider . . . . . . . . . . . . 29-25
Requesting data from the source
dataset or document . . . . . . . . . . . . 29-26
Incremental fetching . . . . . . . . . . . 29-26
Fetch-on-demand . . . . . . . . . . . . . 29-27
Getting parameters from the source
dataset . . . . . . . . . . . . . . . . . . . . 29-27
Passing parameters to the source
dataset . . . . . . . . . . . . . . . . . . . . 29-28
Sending query or stored procedure
parameters . . . . . . . . . . . . . . . . 29-29
Limiting records with parameters . . . 29-29
Handling constraints from the server . . . 29-30
Refreshing records. . . . . . . . . . . . . . 29-31
Communicating with providers using
custom events . . . . . . . . . . . . . . . 29-31
Overriding the source dataset . . . . . . . 29-32
Using a client dataset with file-based
data . . . . . . . . . . . . . . . . . . . . . . . 29-33
Creating a new dataset . . . . . . . . . . . 29-33
Loading data from a file or stream . . . . 29-34
Merging changes into data . . . . . . . . . 29-34
Saving data to a file or stream . . . . . . . 29-35
Using a simple dataset . . . . . . . . . . . . . 29-35
When to use TSimpleDataSet . . . . . . . 29-36
Setting up a simple dataset. . . . . . . . . 29-36
Chapter 30
Using provider components 30-1
Determining the source of data . . . . . . . . . 30-2
Using a dataset as the source of
the data . . . . . . . . . . . . . . . . . . . . 30-2
Using an XML document as the source
of the data . . . . . . . . . . . . . . . . . . 30-2
Communicating with the client dataset . . . . 30-3
Choosing how to apply updates using
a dataset provider . . . . . . . . . . . . . . . . 30-4
Controlling what information is included
in data packets. . . . . . . . . . . . . . . . . . 30-4
Specifying what fields appear in data
packets . . . . . . . . . . . . . . . . . . . . 30-4
Setting options that influence the data
packets . . . . . . . . . . . . . . . . . . . . 30-5
Adding custom information to data
packets . . . . . . . . . . . . . . . . . . . . 30-6
Responding to client data requests . . . . . . . 30-7
Responding to client update requests . . . . . 30-8
Editing delta packets before updating
the database . . . . . . . . . . . . . . . . . 30-9
Influencing how updates are applied . . . 30-10
Screening individual updates . . . . . . . .30-11
Resolving update errors on the
provider. . . . . . . . . . . . . . . . . . . .30-11
Applying updates to datasets that
do not represent a single table . . . . . . 30-12
Responding to client-generated events. . . . 30-12
Handling server constraints . . . . . . . . . . 30-13
xviii
Chapter 31
Creating multi-tiered applications 31-1
Advantages of the multi-tiered database
model . . . . . . . . . . . . . . . . . . . . . . .31-2
Understanding multi-tiered database
applications . . . . . . . . . . . . . . . . . . . .31-2
Overview of a three-tiered application. . . .31-3
The structure of the client application . . . .31-4
The structure of the application server. . . .31-5
The contents of the remote
data module . . . . . . . . . . . . . . . .31-6
Using transactional data modules . . . .31-7
Pooling remote data modules . . . . . . .31-8
Choosing a connection protocol . . . . . . .31-9
Using DCOM connections . . . . . . . . .31-9
Using Socket connections . . . . . . . . .31-9
Using Web connections. . . . . . . . . . 31-10
Using SOAP connections. . . . . . . . . 31-11
Building a multi-tiered application . . . . . . 31-11
Creating the application server. . . . . . . . . 31-12
Setting up the remote data module. . . . . 31-13
Configuring TRemoteDataModule . . . 31-13
Configuring TMTSDataModule. . . . . 31-15
Configuring TSoapDataModule. . . . . 31-16
Extending the application server’s
interface . . . . . . . . . . . . . . . . . . . 31-16
Adding callbacks to the application
server’s interface . . . . . . . . . . . . 31-17
Extending a transactional application
server’s interface . . . . . . . . . . . . 31-17
Managing transactions in multi-tiered
applications . . . . . . . . . . . . . . . . . 31-17
Supporting master/detail
relationships. . . . . . . . . . . . . . . . . 31-18
Supporting state information in remote
data modules . . . . . . . . . . . . . . . . 31-19
Using multiple remote data modules . . . 31-21
Registering the application server . . . . . . . 31-22
Creating the client application . . . . . . . . . 31-22
Connecting to the application server. . . . 31-23
Specifying a connection using
DCOM . . . . . . . . . . . . . . . . . . 31-24
Specifying a connection using
sockets . . . . . . . . . . . . . . . . . . 31-24
Specifying a connection using
HTTP . . . . . . . . . . . . . . . . . . . 31-25
Specifying a connection using
SOAP . . . . . . . . . . . . . . . . . . . 31-26
Brokering connections . . . . . . . . . . 31-27
Managing server connections . . . . . . . 31-27
Connecting to the server . . . . . . . . 31-27
Dropping or changing a server
connection . . . . . . . . . . . . . . . 31-28
Calling server interfaces . . . . . . . . . . 31-28
Using early binding with DCOM . . . 31-29
Using dispatch interfaces with
TCP/IP or HTTP . . . . . . . . . . . . 31-29
Calling the interface of a SOAP-based
server . . . . . . . . . . . . . . . . . . 31-30
Connecting to an application server
that uses multiple data modules . . . . . 31-30
Writing Web-based client applications . . . . 31-31
Distributing a client application as an
ActiveX control . . . . . . . . . . . . . . 31-32
Creating an Active Form for the
client application. . . . . . . . . . . . 31-33
Building Web applications using
InternetExpress . . . . . . . . . . . . . . 31-33
Building an InternetExpress
application . . . . . . . . . . . . . . . . . 31-34
Using the javascript libraries . . . . . . 31-35
Granting permission to access and
launch the application server . . . . . 31-36
Using an XML broker . . . . . . . . . . . . 31-36
Fetching XML data packets. . . . . . . 31-36
Applying updates from XML delta
packets . . . . . . . . . . . . . . . . . 31-37
Creating Web pages with an
InternetExpress page producer . . . . . 31-39
Using the Web page editor . . . . . . . 31-39
Setting Web item properties . . . . . . 31-40
Customizing the InternetExpress
page producer template . . . . . . . . 31-41
Chapter 32
Using XML in database
applications 32-1
Defining transformations . . . . . . . . . . . . 32-1
Mapping between XML nodes and
data packet fields . . . . . . . . . . . . . . 32-2
Using XMLMapper . . . . . . . . . . . . . . 32-4
Loading an XML schema or data
packet . . . . . . . . . . . . . . . . . . . 32-4
Defining mappings . . . . . . . . . . . . 32-5
Generating transformation files . . . . . 32-6
xix
Converting XML documents into data
packets . . . . . . . . . . . . . . . . . . . . . .32-6
Specifying the source XML document . . . .32-6
Specifying the transformation . . . . . . . .32-7
Obtaining the resulting data packet . . . . .32-7
Converting user-defined nodes. . . . . . . .32-7
Using an XML document as the source
for a provider . . . . . . . . . . . . . . . . . . .32-8
Using an XML document as the client of
a provider . . . . . . . . . . . . . . . . . . . . .32-9
Fetching an XML document from
a provider . . . . . . . . . . . . . . . . . . .32-9
Applying updates from an XML
document to a provider . . . . . . . . . . 32-11
Part III
Writing Internet applications
Chapter 33
Creating Internet server
applications 33-1
About Web Broker and WebSnap . . . . . . . .33-1
Terminology and standards. . . . . . . . . . . .33-3
Parts of a Uniform Resource Locator. . . . .33-3
URI vs. URL . . . . . . . . . . . . . . . . .33-4
HTTP request header information . . . . . .33-4
HTTP server activity. . . . . . . . . . . . . . . .33-5
Composing client requests . . . . . . . . . .33-5
Serving client requests . . . . . . . . . . . . .33-5
Responding to client requests. . . . . . . . .33-6
Types of Web server applications . . . . . . . .33-6
ISAPI and NSAPI . . . . . . . . . . . . . .33-6
CGI stand-alone. . . . . . . . . . . . . . .33-6
Apache . . . . . . . . . . . . . . . . . . . .33-7
Web App Debugger. . . . . . . . . . . . .33-7
Converting Web server application
target types . . . . . . . . . . . . . . . . . .33-8
Debugging server applications . . . . . . . . . .33-9
Using the Web Application Debugger . . . .33-9
Launching your application with the
Web Application Debugger . . . . . . .33-9
Converting your application to another
type of Web server application . . . . 33-10
Debugging Web applications that
are DLLs . . . . . . . . . . . . . . . . . . . 33-10
User rights necessary for DLL
debugging . . . . . . . . . . . . . . . . 33-10
Chapter 34
Using Web Broker 34-1
Creating Web server applications with
Web Broker. . . . . . . . . . . . . . . . . . . . 34-1
The Web module. . . . . . . . . . . . . . . . 34-2
The Web Application object . . . . . . . . . 34-3
The structure of a Web Broker application . . . 34-3
The Web dispatcher. . . . . . . . . . . . . . . . 34-5
Adding actions to the dispatcher . . . . . . 34-5
Dispatching request messages . . . . . . . . 34-5
Action items . . . . . . . . . . . . . . . . . . . . 34-6
Determining when action items fire. . . . . 34-6
The target URL. . . . . . . . . . . . . . . 34-6
The request method type . . . . . . . . . 34-7
Enabling and disabling action items. . . 34-7
Choosing a default action item. . . . . . 34-7
Responding to request messages with
action items. . . . . . . . . . . . . . . . . . 34-8
Sending the response . . . . . . . . . . . 34-8
Using multiple action items . . . . . . . 34-9
Accessing client request information . . . . . . 34-9
Properties that contain request header
information. . . . . . . . . . . . . . . . . . 34-9
Properties that identify the target . . . . 34-9
Properties that describe the Web
client. . . . . . . . . . . . . . . . . . . 34-10
Properties that identify the purpose
of the request . . . . . . . . . . . . . . 34-10
Properties that describe the expected
response. . . . . . . . . . . . . . . . . 34-10
Properties that describe the content . . .34-11
The content of HTTP request messages. . .34-11
Creating HTTP response messages . . . . . . .34-11
Filling in the response header . . . . . . . .34-11
Indicating the response status . . . . . 34-12
Indicating the need for client action . . 34-12
Describing the server application . . . 34-12
Describing the content . . . . . . . . . 34-12
Setting the response content . . . . . . . . 34-13
Sending the response . . . . . . . . . . . . 34-13
Generating the content of response
messages . . . . . . . . . . . . . . . . . . . . 34-13
Using page producer components. . . . . 34-14
HTML templates. . . . . . . . . . . . . 34-14
Specifying the HTML template. . . . . 34-15
Converting HTML-transparent
tags . . . . . . . . . . . . . . . . . . . 34-16
xx
Using page producers from an
action item . . . . . . . . . . . . . . . . 34-16
Chaining page producers together . . . 34-17
Using database information in responses . . . 34-18
Adding a session to the Web module . . . 34-18
Representing database information
in HTML. . . . . . . . . . . . . . . . . . . 34-19
Using dataset page producers . . . . . . 34-19
Using table producers . . . . . . . . . . 34-20
Specifying the table attributes. . . . . . 34-20
Specifying the row attributes . . . . . . 34-20
Specifying the columns. . . . . . . . . . 34-20
Embedding tables in HTML
documents . . . . . . . . . . . . . . . . 34-21
Setting up a dataset table producer . . . 34-21
Setting up a query table producer . . . 34-21
Chapter 35
Creating Web Server applications
using WebSnap 35-1
Fundamental WebSnap components. . . . . . .35-2
Web modules . . . . . . . . . . . . . . . . . .35-2
Web application module types . . . . . .35-3
Web page modules . . . . . . . . . . . . .35-4
Web data modules . . . . . . . . . . . . .35-5
Adapters. . . . . . . . . . . . . . . . . . . . .35-5
Fields . . . . . . . . . . . . . . . . . . . . .35-6
Actions . . . . . . . . . . . . . . . . . . . .35-6
Errors. . . . . . . . . . . . . . . . . . . . .35-6
Records. . . . . . . . . . . . . . . . . . . .35-6
Page producers . . . . . . . . . . . . . . . . .35-6
Creating Web server applications with
WebSnap . . . . . . . . . . . . . . . . . . . . .35-7
Selecting a server type . . . . . . . . . . . . .35-8
Specifying application module
components . . . . . . . . . . . . . . . . . .35-9
Selecting Web application module
options . . . . . . . . . . . . . . . . . . . . 35-10
Advanced HTML design . . . . . . . . . . . . 35-11
Manipulating server-side script in
HTML files . . . . . . . . . . . . . . . . . 35-12
Login support . . . . . . . . . . . . . . . . . . 35-13
Adding login support . . . . . . . . . . . . 35-13
Using the sessions service . . . . . . . . . . 35-14
Login pages . . . . . . . . . . . . . . . . . . 35-15
Setting pages to require logins . . . . . . . 35-17
User access rights . . . . . . . . . . . . . . 35-17
Dynamically displaying fields as edit
or text boxes . . . . . . . . . . . . . . 35-18
Hiding fields and their contents . . . . 35-18
Preventing page access . . . . . . . . . 35-19
Server-side scripting in WebSnap . . . . . . . 35-19
Active scripting . . . . . . . . . . . . . . . 35-20
Script engine . . . . . . . . . . . . . . . . . 35-20
Script blocks . . . . . . . . . . . . . . . . . 35-20
Creating script . . . . . . . . . . . . . . . . 35-21
Wizard templates . . . . . . . . . . . . 35-21
TAdapterPageProducer . . . . . . . . . 35-21
Editing and viewing script . . . . . . . . . 35-21
Including script in a page. . . . . . . . . . 35-21
Script objects . . . . . . . . . . . . . . . . . 35-22
Dispatching requests and responses . . . . . 35-22
Dispatcher components. . . . . . . . . . . 35-23
Adapter dispatcher operation . . . . . . . 35-23
Using adapter components to
generate content . . . . . . . . . . . . 35-23
Receiving adapter requests and
generating responses . . . . . . . . . 35-25
Image request . . . . . . . . . . . . . . 35-26
Image response. . . . . . . . . . . . . . 35-27
Dispatching action items . . . . . . . . . . 35-27
Page dispatcher operation . . . . . . . . . 35-28
Chapter 36
Creating Web server applications
using IntraWeb 36-1
Using IntraWeb components. . . . . . . . . . . 36-2
Getting started with IntraWeb. . . . . . . . . . 36-3
Creating a new IntraWeb application . . . . 36-4
Editing the main form . . . . . . . . . . . . 36-4
Writing an event handler for the button . . 36-5
Running the completed application. . . . . 36-6
Using IntraWeb with Web Broker and WebSnap . .
36-7
For more information. . . . . . . . . . . . . . . 36-8
Chapter 37
Working with XML documents 37-1
Using the Document Object Model . . . . . . . 37-2
Working with XML components . . . . . . . . 37-4
Using TXMLDocument . . . . . . . . . . . . 37-4
Working with XML nodes . . . . . . . . . . 37-4
Working with a node’s value . . . . . . . 37-5
Working with a node’s attributes . . . . 37-5
Adding and deleting child nodes . . . . 37-6
xxi
Abstracting XML documents with the
Data Binding wizard. . . . . . . . . . . . . . .37-6
Using the XML Data Binding wizard . . . .37-8
Using code that the XML Data Binding
wizard generates . . . . . . . . . . . . . . .37-9
Chapter 38
Using Web Services 38-1
Understanding invokable interfaces . . . . . . .38-2
Using nonscalar types in invokable
interfaces . . . . . . . . . . . . . . . . . . .38-4
Registering nonscalar types . . . . . . . .38-5
Using remotable objects . . . . . . . . . .38-6
Representing attachments . . . . . . . . .38-7
Managing the lifetime of remotable
objects . . . . . . . . . . . . . . . . . . .38-7
Remotable object example . . . . . . . . .38-7
Writing servers that support Web
Services . . . . . . . . . . . . . . . . . . . . . .38-9
Building a Web Service server . . . . . . . .38-9
Using the SOAP application wizard . . . . 38-10
Adding new Web Services. . . . . . . . . . 38-11
Editing the generated code . . . . . . . 38-12
Using a different base class . . . . . . . 38-12
Using the Web Services Importer. . . . . . 38-13
Browsing for Business services . . . . . . . 38-14
Understanding UDDI . . . . . . . . . . 38-15
Using the UDDI browser. . . . . . . . . 38-15
Defining and using SOAP headers . . . . . 38-16
Defining header classes . . . . . . . . . 38-16
Sending and receiving headers . . . . . 38-16
Communicating the structure of your
headers to other applications . . . . . 38-17
Creating custom exception classes for
Web Services . . . . . . . . . . . . . . . . 38-18
Generating WSDL documents for a
Web Service application . . . . . . . . . . 38-19
Writing clients for Web Services . . . . . . . . 38-20
Importing WSDL documents . . . . . . . . 38-20
Calling invokable interfaces. . . . . . . . . 38-20
Obtaining an invokable interface
from the generated function . . . . . . 38-21
Using a remote interfaced object . . . . 38-21
Processing headers in client applications . 38-23
Chapter 39
Working with sockets 39-1
Implementing services . . . . . . . . . . . . . . 39-1
Understanding service protocols . . . . . . 39-2
Communicating with applications. . . . 39-2
Services and ports . . . . . . . . . . . . . . . 39-2
Types of socket connections . . . . . . . . . . . 39-3
Client connections. . . . . . . . . . . . . . . 39-3
Listening connections. . . . . . . . . . . . . 39-3
Server connections . . . . . . . . . . . . . . 39-3
Describing sockets . . . . . . . . . . . . . . . . 39-4
Describing the host . . . . . . . . . . . . . . 39-4
Choosing between a host name and
an IP address . . . . . . . . . . . . . . . 39-5
Using ports. . . . . . . . . . . . . . . . . . . 39-5
Using socket components . . . . . . . . . . . . 39-6
Getting information about the
connection . . . . . . . . . . . . . . . . . . 39-6
Using client sockets . . . . . . . . . . . . . . 39-6
Specifying the desired server. . . . . . . 39-7
Forming the connection . . . . . . . . . . 39-7
Getting information about the
connection . . . . . . . . . . . . . . . . 39-7
Closing the connection . . . . . . . . . . 39-7
Using server sockets . . . . . . . . . . . . . 39-7
Specifying the port. . . . . . . . . . . . . 39-8
Listening for client requests . . . . . . . 39-8
Connecting to clients . . . . . . . . . . . 39-8
Closing server connections . . . . . . . . 39-8
Responding to socket events. . . . . . . . . . . 39-8
Error events . . . . . . . . . . . . . . . . . . 39-9
Client events . . . . . . . . . . . . . . . . . . 39-9
Server events. . . . . . . . . . . . . . . . . . 39-9
Events when listening . . . . . . . . . . . 39-9
Events with client connections . . . . . 39-10
Reading and writing over socket
connections . . . . . . . . . . . . . . . . . . 39-10
Non-blocking connections . . . . . . . . . 39-10
Reading and writing events . . . . . . .39-11
Blocking connections . . . . . . . . . . . . .39-11
xxii
Part IV
Developing COM-based applications
Chapter 40
Overview of COM technologies 40-1
COM as a specification and
implementation . . . . . . . . . . . . . .40-2
COM extensions . . . . . . . . . . . . . .40-2
Parts of a COM application . . . . . . . . . . . .40-3
COM interfaces . . . . . . . . . . . . . . . . .40-3
The fundamental COM interface,
IUnknown . . . . . . . . . . . . . . . . .40-4
COM interface pointers . . . . . . . . . .40-5
COM servers . . . . . . . . . . . . . . . . . .40-5
CoClasses and class factories . . . . . . .40-6
In-process, out-of-process, and
remote servers . . . . . . . . . . . . . . .40-7
The marshaling mechanism . . . . . . . .40-8
Aggregation . . . . . . . . . . . . . . . . .40-9
COM clients. . . . . . . . . . . . . . . . . . 40-10
COM extensions . . . . . . . . . . . . . . . . . 40-10
Automation servers . . . . . . . . . . . . . 40-12
Active Server Pages . . . . . . . . . . . . . 40-13
ActiveX controls . . . . . . . . . . . . . . . 40-13
Active Documents . . . . . . . . . . . . . . 40-14
Transactional objects . . . . . . . . . . . . . 40-15
Type libraries . . . . . . . . . . . . . . . . . 40-16
The content of type libraries. . . . . . . 40-16
Creating type libraries . . . . . . . . . . 40-17
When to use type libraries . . . . . . . . 40-17
Accessing type libraries . . . . . . . . . 40-18
Benefits of using type libraries . . . . . 40-18
Using type library tools . . . . . . . . . 40-19
Implementing COM objects with
wizards . . . . . . . . . . . . . . . . . . . . . 40-19
Code generated by wizards . . . . . . . . . 40-22
Chapter 41
Working with type libraries 41-1
Type Library editor . . . . . . . . . . . . . . . .41-2
Parts of the Type Library editor. . . . . . . .41-3
Toolbar . . . . . . . . . . . . . . . . . . . .41-3
Object list pane . . . . . . . . . . . . . . .41-5
Status bar . . . . . . . . . . . . . . . . . .41-5
Pages of type information . . . . . . . . .41-6
Type library elements . . . . . . . . . . . . .41-8
Interfaces. . . . . . . . . . . . . . . . . . .41-9
Dispinterfaces . . . . . . . . . . . . . . . .41-9
CoClasses . . . . . . . . . . . . . . . . . 41-10
Type definitions . . . . . . . . . . . . . 41-10
Modules. . . . . . . . . . . . . . . . . . .41-11
Using the Type Library editor . . . . . . . .41-11
Valid types . . . . . . . . . . . . . . . . 41-12
Using Delphi or IDL syntax . . . . . . 41-13
Creating a new type library. . . . . . . 41-19
Opening an existing type library. . . . 41-20
Adding an interface to the type
library . . . . . . . . . . . . . . . . . . 41-21
Modifying an interface using the
type library . . . . . . . . . . . . . . . 41-21
Adding properties and methods to
an interface or dispinterface . . . . . 41-22
Adding a CoClass to the type
library . . . . . . . . . . . . . . . . . . 41-23
Adding an interface to a CoClass . . . 41-23
Adding an enumeration to the
type library . . . . . . . . . . . . . . . 41-24
Adding an alias to the type library . . 41-24
Adding a record or union to the
type library . . . . . . . . . . . . . . . 41-24
Adding a module to the type
library . . . . . . . . . . . . . . . . . . 41-25
Saving and registering type
library information. . . . . . . . . . . 41-25
Apply Updates dialog. . . . . . . . . . 41-26
Saving a type library . . . . . . . . . . 41-26
Refreshing the type library . . . . . . . 41-26
Registering the type library. . . . . . . 41-27
Exporting an IDL file . . . . . . . . . . 41-27
Deploying type libraries . . . . . . . . . . . . 41-27
Chapter 42
Creating COM clients 42-1
Importing type library information. . . . . . . 42-2
Using the Import Type Library dialog . . . 42-3
Using the Import ActiveX dialog . . . . . . 42-4
Code generated when you import
type library information . . . . . . . . . . 42-5
Controlling an imported object . . . . . . . . . 42-6
Using component wrappers . . . . . . . . . 42-6
ActiveX wrappers . . . . . . . . . . . . . 42-6
Automation object wrappers . . . . . . . 42-7
Using data-aware ActiveX controls . . . . . 42-8
Example: Printing a document with
Microsoft Word . . . . . . . . . . . . . . . 42-9
Preparing Delphi for this example. . . 42-10
Importing the Word type library . . . . 42-10
xxiii
Using a VTable or dispatch interface
object to control Microsoft Word . . . 42-11
Cleaning up the example . . . . . . . . 42-12
Writing client code based on type library
definitions . . . . . . . . . . . . . . . . . . 42-13
Connecting to a server . . . . . . . . . . 42-13
Controlling an Automation server
using a dual interface. . . . . . . . . . 42-13
Controlling an Automation server
using a dispatch interface . . . . . . . 42-14
Handling events in an automation
controller. . . . . . . . . . . . . . . . . 42-14
Creating clients for servers that do not
have a type library . . . . . . . . . . . . . . . 42-16
Using .NET Assemblies with Delphi . . . . . 42-17
Requirements for COM
Interoperability . . . . . . . . . . . . . . . 42-17
.NET components and type libraries . . . . 42-18
Accessing user-defined .NET
components . . . . . . . . . . . . . . . . . 42-20
Chapter 43
Creating simple COM servers 43-1
Overview of creating a COM object . . . . . . .43-2
Designing a COM object . . . . . . . . . . . . .43-2
Using the COM object wizard . . . . . . . . . .43-3
Using the Automation object wizard . . . . . .43-5
COM object instancing types . . . . . . . . .43-6
Choosing a threading model . . . . . . . . .43-6
Writing an object that supports the
free threading model . . . . . . . . . . .43-8
Writing an object that supports the
apartment threading model . . . . . . .43-9
Writing an object that supports the
neutral threading model . . . . . . . . .43-9
Defining a COM object’s interface . . . . . . . .43-9
Adding a property to the object’s
interface . . . . . . . . . . . . . . . . . . . 43-10
Adding a method to the object’s
interface . . . . . . . . . . . . . . . . . . . 43-10
Exposing events to clients . . . . . . . . . . 43-11
Managing events in your
Automation object . . . . . . . . . . . 43-12
Automation interfaces. . . . . . . . . . . . . . 43-13
Dual interfaces . . . . . . . . . . . . . . . . 43-13
Dispatch interfaces . . . . . . . . . . . . . . 43-14
Custom interfaces . . . . . . . . . . . . . . 43-15
Marshaling data. . . . . . . . . . . . . . . . . 43-15
Automation compatible types . . . . . . . 43-16
Type restrictions for automatic
marshaling . . . . . . . . . . . . . . . . . 43-16
Custom marshaling . . . . . . . . . . . . . 43-17
Registering a COM object . . . . . . . . . . . 43-17
Registering an in-process server . . . . . . 43-17
Registering an out-of-process server . . . 43-17
Testing and debugging the application. . . . 43-18
Chapter 44
Creating an Active Server Page 44-1
Creating an Active Server Object . . . . . . . . 44-2
Using the ASP intrinsics . . . . . . . . . . . 44-3
Application . . . . . . . . . . . . . . . . . 44-4
Request . . . . . . . . . . . . . . . . . . . 44-4
Response . . . . . . . . . . . . . . . . . . 44-5
Session . . . . . . . . . . . . . . . . . . . 44-6
Server . . . . . . . . . . . . . . . . . . . . 44-6
Creating ASPs for in-process or out-of-
process servers. . . . . . . . . . . . . . . . 44-7
Registering an Active Server Object . . . . . . 44-8
Registering an in-process server . . . . . . . 44-8
Registering an out-of-process server . . . . 44-8
Testing and debugging the Active Server
Page application. . . . . . . . . . . . . . . . . 44-8
Chapter 45
Creating an ActiveX control 45-1
Overview of ActiveX control creation . . . . . 45-2
Elements of an ActiveX control . . . . . . . 45-2
VCL control. . . . . . . . . . . . . . . . . 45-3
ActiveX wrapper. . . . . . . . . . . . . . 45-3
Type library. . . . . . . . . . . . . . . . . 45-3
Property page . . . . . . . . . . . . . . . 45-3
Designing an ActiveX control . . . . . . . . . . 45-4
Generating an ActiveX control from a
VCL control . . . . . . . . . . . . . . . . . . . 45-4
Generating an ActiveX control based on
a VCL form. . . . . . . . . . . . . . . . . . . . 45-6
Licensing ActiveX controls. . . . . . . . . . . . 45-7
Customizing the ActiveX control’s
interface . . . . . . . . . . . . . . . . . . . . . 45-8
Adding additional properties,
methods, and events . . . . . . . . . . . . 45-9
Adding properties and methods . . . . . 45-9
Adding events . . . . . . . . . . . . . . 45-10
Enabling simple data binding with
the type library. . . . . . . . . . . . . . . .45-11
xxiv
Creating a property page for an
ActiveX control . . . . . . . . . . . . . . . . . 45-12
Creating a new property page . . . . . . . 45-13
Adding controls to a property page . . . . 45-13
Associating property page controls
with ActiveX control properties. . . . . . 45-13
Updating the property page . . . . . . . 45-13
Updating the object. . . . . . . . . . . . 45-14
Connecting a property page to
an ActiveX control . . . . . . . . . . . . . 45-14
Registering an ActiveX control . . . . . . . . . 45-15
Testing an ActiveX control . . . . . . . . . . . 45-15
Deploying an ActiveX control on
the Web . . . . . . . . . . . . . . . . . . . . . 45-15
Setting options . . . . . . . . . . . . . . . . 45-16
Chapter 46
Creating MTS or COM+ objects 46-1
Understanding transactional objects. . . . . . .46-2
Requirements for a transactional object . . .46-3
Managing resources . . . . . . . . . . . . . . . .46-3
Accessing the object context. . . . . . . . . .46-4
Just-in-time activation . . . . . . . . . . . . .46-4
Resource pooling . . . . . . . . . . . . . . . .46-5
Database resource dispensers . . . . . . .46-6
Shared property manager . . . . . . . . .46-6
Releasing resources. . . . . . . . . . . . .46-8
Object pooling . . . . . . . . . . . . . . . . .46-8
MTS and COM+ transaction support . . . . . .46-9
Transaction attributes . . . . . . . . . . . . 46-10
Setting the transaction attribute. . . . . 46-11
Stateful and stateless objects . . . . . . . . .46-11
Influencing how transactions end . . . . . 46-12
Initiating transactions. . . . . . . . . . . . 46-12
Setting up a transaction object on
the client side . . . . . . . . . . . . . . 46-13
Setting up a transaction object on
the server side . . . . . . . . . . . . . 46-14
Transaction time-out . . . . . . . . . . . . 46-14
Role-based security . . . . . . . . . . . . . . . 46-15
Overview of creating transactional
objects . . . . . . . . . . . . . . . . . . . . . 46-15
Using the Transactional Object wizard . . . . 46-16
Choosing a threading model for a
transactional object . . . . . . . . . . . . 46-17
Activities . . . . . . . . . . . . . . . . . 46-18
Generating events under COM+ . . . . . . . 46-19
Using the Event Object wizard. . . . . . . 46-21
Using the COM+ Event Subscription
object wizard . . . . . . . . . . . . . . . . 46-22
Firing events using a COM+ event
object . . . . . . . . . . . . . . . . . . . . 46-23
Passing object references . . . . . . . . . . . . 46-23
Using the SafeRef method . . . . . . . 46-24
Callbacks . . . . . . . . . . . . . . . . . 46-25
Debugging and testing transactional
objects . . . . . . . . . . . . . . . . . . . . . 46-25
Installing transactional objects . . . . . . . . 46-26
Administering transactional objects . . . . . 46-27
Index I-1
xxv
1.1 Typefaces and symbols . . . . . . . . . . . 1-2
3.1 Component sublibraries . . . . . . . . . . 3-1
3.2 Important base classes . . . . . . . . . . . 3-5
5.1 Values for the Origin parameter . . . . . . 5-5
5.2 Open modes . . . . . . . . . . . . . . . . . 5-7
5.3 Share modes . . . . . . . . . . . . . . . . . 5-7
5.4 Shared modes available for each
open mode . . . . . . . . . . . . . . . . . . 5-7
5.5 Attribute constants and values. . . . . . . 5-9
5.6 Classes for managing lists . . . . . . . . .5-14
5.7 String comparison routines. . . . . . . . .5-24
5.8 Case conversion routines . . . . . . . . . .5-25
5.9 String modification routines . . . . . . . .5-25
5.10 Sub-string routines . . . . . . . . . . . . .5-25
5.11 Null-terminated string comparison
routines . . . . . . . . . . . . . . . . . . . .5-26
5.12 Case conversion routines for null-
terminated strings . . . . . . . . . . . . . .5-26
5.13 String modification routines . . . . . . . .5-26
5.14 Sub-string routines . . . . . . . . . . . . .5-26
5.15 String copying routines . . . . . . . . . . .5-27
5.16 Compiler directives for strings. . . . . . .5-30
6.1 Component palette pages . . . . . . . . . 6-7
7.1 Properties of selected text. . . . . . . . . . 7-9
7.2 Fixed vs. variable owner-draw styles . . .7-13
8.1 Compiler directives for libraries . . . . . .8-10
8.2 Database pages on the Component
palette . . . . . . . . . . . . . . . . . . . . . 8-11
8.3 Web server applications. . . . . . . . . . .8-13
8.4 Context menu options for data
modules. . . . . . . . . . . . . . . . . . . .8-17
8.5 Help methods in TApplication . . . . . . .8-30
9.1 Action setup terminology. . . . . . . . . .9-18
9.2 Default values of the action manager’s
PrioritySchedule property . . . . . . . . .9-25
9.3 Action classes . . . . . . . . . . . . . . . .9-30
9.4 Methods overriden by base classes
of specific actions . . . . . . . . . . . . . .9-31
9.5 Sample captions and their derived
names . . . . . . . . . . . . . . . . . . . . .9-34
9.6 Menu Designer context menu
commands . . . . . . . . . . . . . . . . . .9-40
9.7 Setting speed buttons’ appearance. . . . .9-48
9.8 Setting tool buttons’ appearance. . . . . .9-50
9.9 Setting a cool button’s appearance. . . . .9-52
10.1 Edit control properties . . . . . . . . . . . 10-2
12.1 Graphic object types . . . . . . . . . . . . 12-3
12.2 Common properties of the Canvas
object . . . . . . . . . . . . . . . . . . . . . 12-4
12.3 Common methods of the Canvas
object . . . . . . . . . . . . . . . . . . . . . 12-4
12.4 CLX MIME types and constants . . . . 12-22
12.5 Mouse events . . . . . . . . . . . . . . . 12-24
12.6 Mouse-event parameters. . . . . . . . . 12-25
12.7 Multimedia device types and their
functions. . . . . . . . . . . . . . . . . . 12-33
13.1 Thread priorities . . . . . . . . . . . . . . 13-3
13.2 WaitFor return values . . . . . . . . . . .13-11
14.1 Selected exception classes . . . . . . . . 14-10
15.1 Porting techniques . . . . . . . . . . . . . 15-2
15.2 Changed or different features . . . . . . . 15-7
15.3 WinCLX-only and equivalent
VisualCLX units. . . . . . . . . . . . . . . 15-8
15.4 VisualCLX-only units . . . . . . . . . . . 15-9
15.5 WinCLX-only units . . . . . . . . . . . . . 15-9
15.6 Differences in the Linux and Windows
operating environments . . . . . . . . . 15-18
15.7 Common Linux directories . . . . . . . 15-20
15.8 Comparable data-access
components . . . . . . . . . . . . . . . . 15-23
15.9 Properties, methods, and events
for cached updates . . . . . . . . . . . . 15-27
16.1 Package files. . . . . . . . . . . . . . . . . 16-2
16.2 Package-specific compiler directives . . .16-11
16.3 Package-specific command-line
compiler switches. . . . . . . . . . . . . 16-13
17.1 VCL methods that support BiDi . . . . . 17-6
17.2 Estimating string lengths . . . . . . . . . 17-7
18.1 Application files . . . . . . . . . . . . . . 18-3
18.2 Merge modules and their
dependencies . . . . . . . . . . . . . . . . 18-4
18.3 dbExpress deployment as stand-alone
executable . . . . . . . . . . . . . . . . . . 18-7
18.4 dbExpress deployment with driver
DLLs . . . . . . . . . . . . . . . . . . . . . 18-8
20.1 Data controls . . . . . . . . . . . . . . . . 20-2
20.2 Column properties . . . . . . . . . . . . 20-20
20.3 Expanded TColumn Title properties . . 20-21
20.4 Properties that affect the way
composite fields appear . . . . . . . . . 20-24
Tables
xxvi
20.5 Expanded TDBGrid Options
properties. . . . . . . . . . . . . . . . . . 20-25
20.6 Grid control events . . . . . . . . . . . . 20-27
20.7 Selected database control grid
properties. . . . . . . . . . . . . . . . . . 20-29
20.8 TDBNavigator buttons . . . . . . . . . . 20-30
21.1 Rave Reports documentation. . . . . . . .21-6
23.1 Database connection components . . . . .23-1
24.1 Values for the dataset State property . . .24-3
24.2 Navigational methods of datasets . . . . .24-5
24.3 Navigational properties of datasets . . . .24-6
24.4 Comparison and logical operators
that can appear in a filter . . . . . . . . . 24-14
24.5 FilterOptions values. . . . . . . . . . . . 24-16
24.6 Filtered dataset navigational
methods. . . . . . . . . . . . . . . . . . . 24-16
24.7 Dataset methods for inserting,
updating, and deleting data . . . . . . . 24-17
24.8 Methods that work with entire
records . . . . . . . . . . . . . . . . . . . 24-22
24.9 Index-based search methods . . . . . . . 24-28
25.1 TFloatField properties that affect
data display . . . . . . . . . . . . . . . . .25-1
25.3 Field component properties . . . . . . . 25-11
25.4 Field component formatting
routines . . . . . . . . . . . . . . . . . . . 25-15
25.5 Field component events. . . . . . . . . . 25-16
25.6 Selected field component methods . . . 25-17
25.7 Special conversion results . . . . . . . . 25-20
25.8 Types of object field components . . . . 25-24
25.9 Common object field descendant
properties. . . . . . . . . . . . . . . . . . 25-24
26.1 Table types recognized by the BDE
based on file extension . . . . . . . . . . .26-5
26.2 TableType values. . . . . . . . . . . . . . .26-6
26.3 BatchMove import modes . . . . . . . . .26-8
26.4 Database-related informational
methods for session components . . . . 26-27
26.5 TSessionList properties and
methods. . . . . . . . . . . . . . . . . . . 26-30
26.6 Properties, methods, and events for
cached updates. . . . . . . . . . . . . . . 26-33
26.7 UpdateKind values . . . . . . . . . . . . 26-39
26.8 Batch move modes. . . . . . . . . . . . . 26-50
26.9 Data Dictionary interface . . . . . . . . . 26-54
27.1 ADO components . . . . . . . . . . . . . .27-2
27.2 Connection parametres . . . . . . . . . . .27-4
27.3 ADO connection modes . . . . . . . . . .27-6
27.4 Execution options for ADO
datasets . . . . . . . . . . . . . . . . . . 27-12
27.5 Comparison of ADO and client
dataset cached updates. . . . . . . . . . 27-13
28.1 Columns in tables of metadata listing
tables . . . . . . . . . . . . . . . . . . . . 28-15
28.2 Columns in tables of metadata listing
stored procedures. . . . . . . . . . . . . 28-15
28.3 Columns in tables of metadata listing
fields . . . . . . . . . . . . . . . . . . . . 28-16
28.4 Columns in tables of metadata listing
indexes. . . . . . . . . . . . . . . . . . . 28-17
28.5 Columns in tables of metadata listing
parameters. . . . . . . . . . . . . . . . . 28-18
29.1 Filter support in client datasets . . . . . . 29-3
29.2 Summary operators for maintained
aggregates . . . . . . . . . . . . . . . . . 29-12
29.3 Specialized client datasets for caching
updates . . . . . . . . . . . . . . . . . . 29-18
30.1 AppServer interface members. . . . . . . 30-3
30.2 Provider options . . . . . . . . . . . . . . 30-5
30.3 UpdateStatus values . . . . . . . . . . . . 30-9
30.4 UpdateMode values . . . . . . . . . . . 30-10
30.5 ProviderFlags values . . . . . . . . . . . 30-10
31.1 Components used in multi-tiered
applications . . . . . . . . . . . . . . . . . 31-3
31.2 Connection components . . . . . . . . . . 31-5
31.3 Javascript libraries . . . . . . . . . . . . 31-35
33.1 Web Broker versus WebSnap . . . . . . . 33-2
34.1 MethodType values. . . . . . . . . . . . . 34-7
35.1 Web application module types . . . . . . 35-3
35.2 Web server application types . . . . . . . 35-8
35.3 Web application components . . . . . . . 35-9
35.4 Script objects . . . . . . . . . . . . . . . 35-22
35.5 Request information found in action
requests . . . . . . . . . . . . . . . . . . 35-25
36.1 VCL/CLX and IntraWeb
components . . . . . . . . . . . . . . . . . 36-2
38.1 Remotable classes. . . . . . . . . . . . . . 38-6
40.1 COM object requirements . . . . . . . . 40-12
40.2 Delphi wizards for implementing COM,
Automation, and ActiveX objects. . . . 40-21
40.3 DAX Base classes for generated
implementation classes . . . . . . . . . 40-23
41.1 Type Library editor files . . . . . . . . . . 41-2
41.2 Type Library editor parts . . . . . . . . . 41-3
41.3 Attribute syntax. . . . . . . . . . . . . . 41-14
43.1 Threading models for COM objects . . . 43-7
xxvii
44.1 IApplicationObject interface
members . . . . . . . . . . . . . . . . . . .44-4
44.2 IRequest interface members . . . . . . . .44-4
44.3 IResponse interface members . . . . . . .44-5
44.4 ISessionObject interface members . . . . .44-6
44.5 IServer interface members . . . . . . . . .44-6
46.1 IObjectContext methods for
transaction support. . . . . . . . . . . . 46-12
46.2 Threading models for transactional
objects . . . . . . . . . . . . . . . . . . . 46-17
46.3 Call synchronization options . . . . . . 46-19
46.4 Event publisher return codes . . . . . . 46-23
xxviii
3.1 A simplified hierarchy diagram . . . . . . 3-5
4.1 A simple form . . . . . . . . . . . . . . . . 4-3
9.1 A frame with data-aware controls and
a data source component . . . . . . . . . .9-16
9.3 Menu terminology. . . . . . . . . . . . . .9-32
9.4 MainMenu and PopupMenu
components . . . . . . . . . . . . . . . . .9-33
9.6 Adding menu items to a main menu . . .9-36
9.7 Nested menu structures. . . . . . . . . . .9-37
10.2 A progress bar . . . . . . . . . . . . . . . 10-16
11.1 Part of the ModelMaker toolbar . . . . . . 11-3
11.2 ModelMaker showing a sample
model . . . . . . . . . . . . . . . . . . . . . 11-4
11.3 The Classes view. . . . . . . . . . . . . . . 11-5
11.4 The Units view . . . . . . . . . . . . . . . . 11-5
11.5 The Diagrams view . . . . . . . . . . . . . 11-6
11.6 The Members view . . . . . . . . . . . . . 11-7
11.7 The Implementation Editor view . . . . . 11-8
11.8 The Unit Code Editor . . . . . . . . . . . . 11-8
11.9 The Diagram Editor . . . . . . . . . . . . . 11-9
12.1 Bitmap-dimension dialog box from
the BMPDlg unit . . . . . . . . . . . . . . 12-21
17.1 TListBox set to bdLeftToRight . . . . . . .17-5
17.2 TListBox set to bdRightToLeft . . . . . . .17-5
17.3 TListBox set to
bdRightToLeftNoAlign . . . . . . . . . . .17-5
17.4 TListBox set to
bdRightToLeftReadingOnly . . . . . . . .17-5
19.1 Generic Database Architecture . . . . . . .19-6
19.2 Connecting directly to the
database server. . . . . . . . . . . . . . . .19-8
19.3 A file-based database application . . . . .19-9
19.4 Architecture combining a client dataset
and another dataset . . . . . . . . . . . . 19-12
19.5 Multi-tiered database architecture . . . . 19-13
20.1 TDBGrid control . . . . . . . . . . . . . . 20-15
20.2 TDBGrid control with ObjectView
set to False . . . . . . . . . . . . . . . . . 20-23
20.3 TDBGrid control with Expanded
set to False . . . . . . . . . . . . . . . . . 20-23
20.4 TDBGrid control with Expanded
set to True. . . . . . . . . . . . . . . . . . 20-24
20.5 TDBCtrlGrid at design time . . . . . . . 20-28
20.6 Buttons on the TDBNavigator
control . . . . . . . . . . . . . . . . . . . 20-29
22.1 Decision support components at
design time . . . . . . . . . . . . . . . . . 22-2
22.2 One-dimensional crosstab . . . . . . . . . 22-3
22.3 Three-dimensional crosstab . . . . . . . . 22-3
22.4 Decision graphs bound to different
decision sources. . . . . . . . . . . . . . 22-15
26.1 Components in a BDE-based
application. . . . . . . . . . . . . . . . . . 26-2
31.1 Web-based multi-tiered database
application. . . . . . . . . . . . . . . . . 31-31
33.1 Parts of a Uniform Resource
Locator . . . . . . . . . . . . . . . . . . . . 33-3
34.1 Structure of a Server Application . . . . . 34-4
35.2 Web App Components dialog. . . . . . . 35-9
35.3 Web App Components dialog with
options for login support selected . . . 35-14
35.4 An example of a login page as seen
from a Web page editor . . . . . . . . . 35-16
35.5 Generating content flow . . . . . . . . . 35-24
35.6 Action request and response . . . . . . 35-26
35.7 Image response to a request . . . . . . . 35-27
35.8 Dispatching a page . . . . . . . . . . . . 35-28
36.2 The main form of the IntraWeb
application. . . . . . . . . . . . . . . . . . 36-5
40.1 A COM interface . . . . . . . . . . . . . . 40-3
40.2 Interface vtable . . . . . . . . . . . . . . . 40-5
40.3 In-process server . . . . . . . . . . . . . . 40-7
40.4 Out-of-process and remote servers . . . . 40-8
40.5 COM-based technologies . . . . . . . . .40-11
40.6 Simple COM object interface . . . . . . 40-20
40.7 Automation object interface . . . . . . . 40-20
40.8 ActiveX object interface . . . . . . . . . 40-20
40.9 Delphi ActiveX framework . . . . . . . 40-23
41.1 Type Library editor . . . . . . . . . . . . . 41-3
41.2 Object list pane . . . . . . . . . . . . . . . 41-5
43.1 Dual interface VTable . . . . . . . . . . 43-14
45.1 Mask Edit property page in
design mode. . . . . . . . . . . . . . . . 45-13
46.1 The COM+ Events system . . . . . . . . 46-21
Figures
I n t r o d u c t i o n 1-1
C h a p t e r
1
Chapter1Introduction
The Developer’s Guide describes intermediate and advanced development topics, such
as building client/server database applications, creating Internet Web server
applications, and writing custom components. 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 editions 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
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 develop cross-platform applications that can be
compiled and run on either Windows or Linux platforms.
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
1-2 D e v e l o p e r ’ s G u i d e
M a n u a l c o n v e n t i o n s
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. You can access several types of
databases, including local databases such as Paradox and dBASE, and network
SQL server databases such as InterBase, Oracle, and Sybase. You can choose from
a variety of data access mechanisms, including dbExpress, InterbaseExpress, and
ADO. To implement the more advanced database applications, you need the
features that are not available in all editions.
• 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, with which you
can create cross-platform server applications; WebSnap, with which you can
design Web pages in a GUI environment; support for working with XML
documents; and BizSnap, 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 editions.
• 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. A Type Library editor simplifies the development of COM servers.
Support for COM controls and ActiveX controls is not available in all editions of
Delphi.
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 Delphi 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 Delphi keywords or
compiler options. Boldface is also used to emphasize certain words, such as
new terms.
Italics Italicized words in text represent Delphi identifiers, such as variable or
type names.
Keycaps This typeface indicates a key on your keyboard. For example, “Press Esc to
exit a menu.”
I n t r o d u c t i o n 1-3
D e v e l o p e r s u p p o r t s e r v i c e s
Developer support services
Borland offers a variety of support options, including free services on the Internet,
where you can search our extensive information base and connect with other users of
Borland products, technical support, and fee-based consultant-level support.
For more information about Borland’s developer support services, please see our
Web site at http://www.borland.com/devsupport/delphi, call Borland Assist at
(800) 523-7070, or contact our Sales Department at (831) 431-1064. For customers
outside of the United States of America, see our Web site at
http://www.borland.com/bww.
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.
When contacting support, be prepared to provide complete information about your
environment, the version and edition of the product you are using, and a detailed
description of the problem.
1-4 D e v e l o p e r ’ s G u i d e
P r o g r a m m i n g w i t h D e l p h i
P a r t
I
PartIProgramming with Delphi
The chapters in “Programming with Delphi” introduce concepts and skills necessary
for creating applications using any edition of Delphi.
Developers Guide Borland Delphi 7 For Windows Borland Software Corporation
D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-1
C h a p t e r
2
Chapter2Developing applications with Delphi
Borland Delphi is an object-oriented, visual programming environment to develop
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 suite of Rapid Application Development (RAD) design tools,
including programming wizards and application and form templates, and supports
object-oriented programming with a comprehensive class library that includes:
• The Visual Component Library (VCL), which includes objects that encapsulate the
Windows API as well as other useful programming techniques (Windows).
• The Borland Component Library for Cross-Platform (CLX), which 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, 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 IDE provides all the tools you
need to design, develop, test, debug, and deploy applications, allowing rapid
prototyping and a shorter development time.
The IDE includes all the tools necessary to start designing applications, such as the:
• Form Designer, or form, a blank window on which to design the user interface (UI)
for your application.
• Component palette for displaying visual and nonvisual components you can use
to design your user interface.
2-2 D e v e l o p e r ’ s G u i d e
D e s i g n i n g a p p l i c a t i o n s
• Object Inspector for examining and changing an object’s properties and events.
• Object TreeView for displaying and changing a components’ logical relationships.
• Code editor for writing and editing the underlying program logic.
• Project Manager for managing the files that make up one or more projects.
• Integrated debugger for finding and fixing errors in your code.
• Many other tools such as property editors to change the values for an object’s
property.
• Command-line tools including compilers, linkers, and other utilities.
• Extensive class libraries with many reusable objects. Many of the objects provided
in the class library are accessible in the IDE from the Component palette. By
convention, the names of objects in the class library begin with a T, such as
TStatusBar. Names of objects that begin with a Q are based on the Qt library and
are used for cross-platform applications.
Some tools may not be included in all editions of the product.
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, dialog boxes, and windows.
Designing applications
You can design any kind of 32-bit application—from general-purpose utilities to
sophisticated data access programs or distributed applications.
As you visually design the user interface for your application, the Form Designer
generates the underlying Delphi 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.
You can create your own components using the Delphi language. Most of the
components provided are written in Delphi. 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 design applications that run on both Linux and Windows by using CLX
components. CLX contains a set of classes that, if used instead of those in the VCL,
allows your program to port between Windows and Linux. Refer to Chapter 15,
“Developing cross-platform applications” for details about cross-platform
programming and the differences between the Windows and Linux environments. If
you are using Kylix while developing cross-platform applications, Kylix also
D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-3
C r e a t i n g p r o j e c t s
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.
Chapter 8, “Building applications, components, and libraries,” introduces support
for different types of applications.
Creating projects
All 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.
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, and compiler. These
project options are stored in the project file with the project.
Units and forms are the basic building blocks of an 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.
2-4 D e v e l o p e r ’ s G u i d e
E d i t i n g c o d e
Editing code
The 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 changes 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 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, and project files—can be
viewed and edited in the Code editor.
Compiling applications
When you have finished designing your application interface on the form and
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 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 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.
Note To compile a CLX application on Linux, you need Kylix.
D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-5
D e b u g g i n g a p p l i c a t i o n s
Debugging applications
With the integrated debugger, you can 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 variable values, 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 are classes, like other classes in Delphi, except, by convention, they begin
with an initial E rather than a T.
Deploying applications
Delphi includes add-on tools to help with application deployment. For example,
InstallShield Express (not available in all editions) helps you to create an installation
package for your application that includes all of the files needed for running a
distributed application. TeamSource software (not available in all editions) is also
available for tracking application updates.
To deploy a CLX application on Linux, you need Kylix.
Note Not all editions have deployment capabilities.
Refer to Chapter 18, “Deploying applications,” for specific information on
deployment.
2-6 D e v e l o p e r ’ s G u i d e
U s i n g t h e c o m p o n e n t l i b r a r y 3-1
C h a p t e r
3
Chapter3Using the component library
This chapter presents an overview of the component library that you use while
developing applications. The component library includes the Visual Component
Library (VCL) and the Borland Component Library for Cross-Platform (CLX). The
VCL is for Windows-only development and CLX is for cross-platform development
on both Windows and Linux. The component library is extensive, containing both
components that you can work with in the IDE and classes that you create and use in
runtime code. Some of the classes can be used in any application, while others can
only appear in certain types of applications.
Understanding the component library
The component library is made up of objects separated into several sublibraries, each
of which serves a different purpose. These sublibraries are listed in Table 3.1:
Table 3.1 Component sublibraries
Part Description
BaseCLX Low-level classes and routines available for all CLX applications. BaseCLX includes
the runtime library (RTL) up to and including the Classes unit.
DataCLX Client data-access components. The components in DataCLX are a subset of the total
available set of components for working with databases. These components are used
in cross-platform applications that access databases. They can access data from a file
on disk or from a database server using dbExpress.
NetCLX Components for building Web Server applications. These include support for
applications that use Apache or CGI Web Servers.
3-2 D e v e l o p e r ’ s G u i d e
U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y
The VCL and CLX contain many of the same sublibraries. They both include
BaseCLX, DataCLX, NetCLX. The VCL also includes WinCLX while CLX includes
VisualCLX instead. Use the VCL when you want to use native Windows controls,
Windows-specific features, or extend an existing VCL application. Use CLX when
you want to write a cross-platform application or use controls that are available in
CLX applications, such as TLCDNumber. For more information on writing cross-
platform applications, see Chapter 15, “Developing cross-platform applications.”
All classes descend from TObject. TObject introduces methods that implement
fundamental behavior like construction, destruction, and message handling.
Components are a subset of the component library that descend from the class
TComponent. You can place components on a form or data module and manipulate
them at design time. Using the Object Inspector, you can assign property values
without writing code. Most components are either visual or nonvisual, depending on
whether they are visible at runtime. Some components appear on the Component
palette.
Visual components, such as TForm and TSpeedButton, are called controls and descend
from TControl. Controls are used in GUI applications, and appear to the user at
runtime. TControl provides properties that specify the visual attributes of controls,
such as their height and width.
Nonvisual components are used for a variety of tasks. For example, if you are writing
an application that connects to a database, you can place a TDataSource component
on a form to connect a control and a dataset used by the control. This connection is
not visible to the user, so TDataSource is nonvisual. At design time, nonvisual
components are represented by an icon. This allows you to manipulate their
properties and events just as you would a visual control.
Classes that are not components (that is, classes that descend from TObject but not
TComponent) are also used for a variety of tasks. Typically, these classes are used for
accessing system objects (such as a file or the clipboard) or for transient tasks (such as
storing data in a list). You can’t create instances of these classes at design time,
although they are sometimes created by the components that you add in the Form
Designer.
VisualCLX Cross-platform GUI components and graphics classes. VisualCLX classes make use
of an underlying cross-platform widget library (Qt).
WinCLX Classes that are available only on the Windows platform. These include controls that
are wrappers for native Windows controls, database access components that use
mechanisms (such as the Borland Database Engine or ADO) that are not available on
Linux, and components that support Windows-only technologies (such as COM, NT
Services, or control panel applets).
Table 3.1 Component sublibraries (continued)
Part Description
U s i n g t h e c o m p o n e n t l i b r a r y 3-3
U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y
Detailed reference material on all VCL and CLX objects is accessible through online
Help while you are programming. In the Code editor, place the cursor anywhere on
the object and press F1 to display the Help topic. Objects, properties, methods, and
events that are in the VCL are marked “VCL Reference” and those in CLX are
marked “CLX Reference.”
Properties, methods, and events
Both the VCL and CLX form hierarchies of classes that are tied to the IDE, where you
can develop applications quickly. The classes in both component libraries are based
on properties, methods, and events. Each class includes data members (properties),
functions that operate on the data (methods), and a way to interact with users of the
class (events). The component library is written in the Delphi language, although the
VCL is based on the Windows API and CLX is based on the Qt widget 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 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
some properties at design time and get immediate feedback as the components
change in the IDE.
• You can access some properties 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 calls to get and set the values of properties can be 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 a property. For example, changing the value of one property may require
you to modify another. You can change the methods created for the property.
• Properties can be virtual.
• A property is not restricted to a single object. Changing one property on one object
can affect several objects. For example, setting the Checked property on a radio
button affects all of the radio buttons in the group.
3-4 D e v e l o p e r ’ s G u i d e
U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y
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 fields of the class and are commonly referred to as member functions.
See “Controlling access” on page 2-4 of the Component Writer’s Guide. Although most
methods belong to an instance of a class, some methods belong instead to the class
type. These are called class methods.
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. For example, the user may choose a menu item, click a button, or
mark some text. You can write code to handle the events in which you are interested,
rather than writing code that always executes in the same restricted order.
Regardless of how an event is triggered, VCL objects look 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
• Internal events
User events
User events are actions that the user initiates. 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).
System events
System events are events that the operating system fires for you. For example, the
OnTimer event (which the Timer component issues whenever a predefined interval
has elapsed), 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.
Internal events
Internal events are events that are generated by the objects in your application. An
example of an internal event is the OnPost event that a dataset generates when your
application tells it to post the current record.
U s i n g t h e c o m p o n e n t l i b r a r y 3-5
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
Objects, components, and controls
Figure 3.2 is a greatly simplified view of the inheritance hierarchy that illustrates the
relationship between objects, components, and controls.
Figure 3.1 A simplified hierarchy diagram
Every object (class) inherits from TObject. Objects that can appear in the Form
Designer inherit from TPersistent or TComponent. Controls, which appear to the user
at runtime, inherit from TControl. There are two types of controls, graphic controls,
which inherit from TGraphicControl, and windowed controls, which inherit from
TWinControl or TWidgetControl. A control like TCheckBox inherits all the functionality
of TObject, TPersistent, TComponent, TControl, and TWinControl or TWidgetControl,
and adds specialized capabilities of its own.
The figure shows several important base classes, which are described in the
following table:
Table 3.2 Important base classes
Class Description
TObject Signifies the base class and ultimate ancestor of everything in the VCL or CLX.
TObject encapsulates the fundamental behavior common to all VCL/CLX
objects by introducing methods that perform basic functions such as creating,
maintaining, and destroying an instance of an object.
Exception Specifies the base class of all classes that relate to VCL exceptions. Exception
provides a consistent interface for error conditions, and enables applications to
handle error conditions gracefully.
TPersistent Specifies the base class for all objects that implement publishable properties.
Classes under TPersistent deal with sending data to streams and allow for the
assignment of classes.
TComponent Specifies the base class for all components. Components can be added to the
Component palette and manipulated at design time. Components can own
other components.
TObject
TGraphicControl
Exception
TComponent TControl TWinControl*
TPersistent
[Objects]
[Objects]
[Objects]
[Objects] [Objects] [Objects]
* TWidgetControl in cross-platform applications.
3-6 D e v e l o p e r ’ s G u i d e
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
The next few sections present a general description of the types of classes that each
branch contains. For a complete overview of the VCL and CLX object hierarchies,
refer to the VCL Object Hierarchy and CLX Object Hierarchy wall charts included
with this product.
TObject branch
The TObject branch includes all VCL and CLX classes that descend from TObject but
not from TPersistent. Much of the powerful capability of the component library is
established by the methods that TObject introduces. TObject encapsulates the
fundamental behavior common to all classes in the component library by introducing
methods that provide:
• The ability to respond when object instances are created or destroyed.
• Class type and instance information on an object, and runtime type information
(RTTI) about its published properties.
• Support for handling messages (VCL applications) or handling notifications (CLX
applications).
TObject is the immediate ancestor of many simple classes. Classes in the TObject
branch have one common, important characteristic: they are transitory. This means
that these classes do not have a method to save the state that they are in prior to
destruction; they are not persistent.
One of the main groups of classes in this branch is the Exception class. This class
provides a large set of built-in exception classes for automatically handling divide-
by-zero errors, file I/O errors, invalid typecasts, and many other exception
conditions.
Another group in the TObject branch is classes that encapsulate data structures, such
as:
• TBits, a class that stores an “array” of Boolean values.
• TList, a linked list class.
• TStack, a class that maintains a last-in first-out array of pointers.
• TQueue, a class that maintains a first-in first-out array of pointers.
Another group in the TObject branch are wrappers for external objects like TPrinter,
which encapsulates a printer interface, and TIniFile, which lets a program read from
or write to an ini file.
TControl Represents the base class for all controls that are visible at runtime. TControl is
the common ancestor of all visual components and provides standard visual
controls like position and cursor. This class also provides events that respond to
mouse actions.
TWinControl or
TWidgetControl
Specifies the base class of all controls that can have keyboard focus. Controls
under TWinControl are called windowed controls while those under
TWidgetControl are called widgets.
Table 3.2 Important base classes (continued)
Class Description
U s i n g t h e c o m p o n e n t l i b r a r y 3-7
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
TStream is a good example of another type of class in this branch. TStream is the base
class type for stream objects that can read from or write to various kinds of storage
media, such as disk files, dynamic memory, and so on (see “Using streams” on
page 5-2 for information on streams).
See Chapter 5, “Using BaseCLX,” for information on many of the classes in the
TObject branch (as well as on many global routines in the Delphi Runtime Library).
TPersistent branch
The TPersistent branch includes all VCL and CLX classes that descend from
TPersistent but not from TComponent. Persistence determines what gets saved with a
form file or data module and what gets loaded into the form or data module when it
is retrieved from memory.
Because of their persistence, objects from this branch can appear at design time.
However, they can’t exist independently. Rather, they implement properties for
components. Properties are only loaded and saved with a form if they have an
owner. The owner must be some component. TPersistent introduces the GetOwner
method, which lets the Form Designer determine the owner of the object.
Classes in this branch are also the first to include a published section where
properties can be automatically loaded and saved. A DefineProperties method lets
each class indicate how to load and save properties.
Following are some of the classes in the TPersistent branch of the hierarchy:
• Graphics such as: TBrush, TFont, and TPen.
• Classes such as TBitmap and TIcon, which store and display visual images, and
TClipboard, which contains text or graphics that have been cut or copied from an
application.
• String lists, such as TStringList, which represent text or lists of strings that can be
assigned at design time.
• Collections and collection items, which descend from TCollection or
TCollectionItem. These classes maintain indexed collections of specially defined
items that belong to a component. Examples include THeaderSections and
THeaderSection or TListColumns and TListColumn.
TComponent branch
The TComponent branch contains classes that descend from TComponent but not
TControl. Objects in this branch are components that you can manipulate on forms at
design time but which do not appear to the user at runtime. They are persistent
objects that can do the following:
• Appear on the Component palette and be changed on the form.
• Own and manage other components.
• Load and save themselves.
3-8 D e v e l o p e r ’ s G u i d e
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
Several methods introduced by TComponent dictate how components act during
design time and what information gets saved with the component. Streaming (the
saving and loading of form files, which store information about the property values
of objects on a form) is introduced in this branch. Properties are persistent if they are
published and published properties are automatically streamed.
The TComponent branch also introduces the concept of ownership that is propagated
throughout the component library. Two properties support ownership: Owner and
Components. Every component has an Owner property that references another
component as its owner. A component may own other components. In this case, all
owned components are referenced in the component’s Components property.
The constructor for every component takes a parameter that specifies the new
component's owner. If the passed-in owner exists, the new component is added to
that owner's Components list. Aside from using the Components list to reference
owned components, this property also provides for the automatic destruction of
owned components. As long as the component has an owner, it will be destroyed
when the owner is destroyed. For example, since TForm is a descendant of
TComponent, all components owned by a form are destroyed and their memory freed
when the form is destroyed. (Assuming, of course, that the components have
properly designed destructors that clean them up correctly.)
If a property type is a TComponent or a descendant, the streaming system creates an
instance of that type when reading it in. If a property type is TPersistent but not
TComponent, the streaming system uses the existing instance available through the
property and reads values for that instance’s properties.
Some of the classes in the TComponent branch include:
• TActionList, a class that maintains a list of actions, which provides an abstraction
of the responses your program can make to user input.
• TMainMenu, a class that provides a menu bar and its accompanying drop-down
menus for a form.
• TOpenDialog, TSaveDialog, TFontDialog, TFindDialog, TColorDialog, and so on,
classes that display and gather information from commonly used dialog boxes.
• TScreen, a class that keeps track of the forms and data modules that an application
creates, the active form, the active control within that form, the size and resolution
of the screen, and the cursors and fonts available for the application to use.
Components that do not need a visual interface can be derived directly from
TComponent. To make a tool such as a TTimer device, you can derive from
TComponent. This type of component resides on the Component palette but performs
internal functions that are accessed through code rather than appearing in the user
interface at runtime.
See Chapter 6, “Working with components,” for details on setting properties, calling
methods, and working with events for components.
U s i n g t h e c o m p o n e n t l i b r a r y 3-9
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
TControl branch
The TControl branch consists of components that descend from TControl but not
TWinControl (TWidgetControl in CLX applications). Classes in this branch are
controls: visual objects that the user can see and manipulate at runtime. All controls
have properties, methods, and events in common that relate to how the control looks,
such as its position, the cursor associated with the control’s window, methods to
paint or move the control, and events to respond to mouse actions. Controls in this
branch, however, can never receive keyboard input.
Whereas TComponent defines behavior for all components, TControl defines behavior
for all visual controls. This includes drawing routines, standard events, and
containership.
TControl introduces many visual properties that all controls inherit. These include the
Caption, Color, Font, and HelpContext or HelpKeyword. While these properties inherited
from TControl, they are only published—and hence appear in the Object Inspector—
for controls to which they are applicable. For example, TImage does not publish the
Color property, since its color is determined by the graphic it displays. TControl also
introduces the Parent property, which specifies another control that visually contains
the control.
Classes in the TControl branch often called graphic controls, because they all descend
from TGraphicControl, which is an immediate descendant of TControl. Although these
controls appear to the user at runtime, graphic controls do not have their own
underlying window or widget. Instead, they use their parent’s window or widget. It
is because of this limitation that graphic controls cant receive keyboard input or act
as a parent to other controls. However, because they do not have their own window
or widget, graphic controls use fewer system resources. For details on many of the
classes in the TControl branch, see “Graphic controls” on page 10-19.
There are two versions of TControl, one for VCL (Windows-only) applications and
one for CLX (cross-platform) applications. Most controls have two versions as well, a
Windows-only version that descends from the Windows-only version of TControl,
and a cross-platform version that descends from the cross-platform version of
TControl. The Windows-only controls use native Windows APIs in their
implementations, while the cross-platform versions sit on top of the Qt cross-
platform widget library.
See Chapter 7, “Working with controls,” for details on how to interact with controls
at runtime.
3-10 D e v e l o p e r ’ s G u i d e
O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s
TWinControl/TWidgetControl branch
Most controls fall into the TWinControl/ TWidgetControl branch. Unlike graphic
controls, controls in this branch have their own associated window or widget.
Because of this, they are sometimes called windowed controls or widget controls.
Windowed controls all descend from TWinControl, which descends from the
windows-only version of TControl. Widget controls all descend from TWidgetControl,
which descends from the cross-platform version of TControl.
Controls in the TWinControl/TWidgetControl branch:
• Can receive focus while an application is running, which means they can receive
keyboard input from the application user. In comparison, graphic controls can
only display data and respond to the mouse.
• Can be the parent of one or more child controls.
• Have a handle, or unique identifier, that allows them to access the underlying
window or widget.
The TWinControl/TWidgetControl branch includes both controls that are drawn
automatically (such as TEdit, TListBox, TComboBox, TPageControl, and so on) and
custom controls that do not correspond directly to a single underlying Windows
control or widget. Controls in this latter category, which includes classes like
TStringGrid and TDBNavigator, must handle the details of painting themselves.
Because of this, they descend from TCustomControl, which introduces a Canvas
property on which they can paint themselves.
For details on many of the controls in the TWinControl/TWidgetControl branch, see
Chapter 10, “Types of controls.”
Another Random Scribd Document
with Unrelated Content
hundred years after. The wrong done the body politic may fester
unseen, but it festers on all the same.
Fortunately for the people there is yet a feature in the situation that
gives us hope. We are blessed with no inconsiderable body of men
of sufficient sense and conscience to rise above party control and
vote in support of good measures and honest, capable men. These
are not men dominated by one idea, and devoted to some one
measure that is to remedy all our political ills. These are "cranks," so
called, because they believe that human nature is constructed like
machinery—something like a coffee-mill that has a crank that, if
turned and turned vigorously, will put the entire machine in good
running order. To some this is temperance, to others the tariff, to a
third our common-school system: and so they give their lives to a
vociferous demand for help to turn the one peculiar crank.
We refer, not to such as these, but the thoughtful, patriotic few who
rise above party obligations to a consideration of their country's
good. These men are not organized into a party,—unless the fact of
two men thinking and feeling alike make a party,—and, as compared
to the Republican and Democratic camp-followers, are few in
number. But, in the evenly divided condition of the two
organizations, these men hold the balance of power, and are
dreaded in consequence. Had it not been for the money used by
Republicans, and the treachery practised by a few leading
Democrats, these independents would have given New York to the
Democracy, and Grover Cleveland would be President for the next
four years.
These men are derided, scoffed at, and held in high disdain by the
partisans of both parties. They are called Mugwumps; and when this
strange epithet is hurled at them the assailant seems to feel
relieved. This is no new thing. Among the traditions of the Church is
one to the effect that as the devil talks he spits fire. All reformers are
treated to this. It is well remembered that in the troublous times of
'61 the Mugwumps, then denounced as Abolitionists, came to the
front and carried the government through its dark hour of peril to a
triumphant close. They were brave, brainy, patriotic men, not
disturbed by the abuse heaped upon them.
We are comforted to observe the power of these few men as proved
in the debate on the civil-service law of the House when an
appropriation was called for to sustain the Commission. The debate
proved what we all know—that probably not a member of the House
but regards the reform in utter loathing and wrath. And yet, when
the vote was taken, but a small minority were willing to put
themselves on record in opposition. The same clear appreciation of
the evil consequences attending this corruption of the ballot, and the
conscience that makes itself felt as that of the people, are forcing a
reform in that direction. The time is not distant when the now much-
reviled Mugwumps will be regarded, as are the Abolitionists, as the
true patriots of the day. God would have forgiven Sodom and
Gomorrah could five righteous men have been found in either city:
this not out of regard for the five, but from the evidence afforded
that if that number existed, these wicked places could not be
altogether lost.
OUR HOUSE OF LORDS.
The dignity of this unnecessary and disagreeable body was
somewhat disturbed by a Senator in a wild state of intoxication, who
from his place in the Chamber assailed in unseemly language the
presiding officer.
Great consternation fell upon the British House of Commons when
the discovery was made that an entire session had been gone
through without "that bauble," as Oliver Cromwell called it, being
upon the table. When Doctor Kenealy, friend and attorney of the
Tichborne Claimant, was about being sworn in as a member of
Parliament, it was observed that he had a cotton umbrella under his
arm. A horror too profound for utterance fell upon the House, and all
proceedings were arrested until the obnoxious compound of cotton
and whalebone was removed.
We refer to these events for the purpose of impressing upon our
delegated sovereigns from sovereign States, that unless the
proprieties are preserved their dignity cannot be maintained. What
would be thought of the British House of Lords if Lord Tomnoddy, for
example, were to roll in very drunk, and make personal remarks
touching the integrity of the presiding officer? The thought of such
an event threatens insanity. The British Empire would totter, the
throne shake, and the House of Lords disappear forever.
The inebriated Senator was not arrested, or even rebuked. We all
know why. On his one vote depends the Republican control of the
Senate. To seize upon, arrest, and cart away, under charge of
drunken and disorderly conduct, the Republican majority of the
Senate was so preposterous as not to be entertained.
As force could not be used, strategy was resorted to, and the
inebriate Solon was invited out to take more drinks, in the hope that
a little more liquid insanity would render him hors de combat.
This is not the first instance of embarrassment of like sort. When the
men who organized the Star Route dishonesty of the Post-office
Department were indicted, it was found that the head and front of
this offending was a United States Senator. He held the one vote
that gave his party its supremacy in the Senate. To send the
Republican majority vote to the penitentiary was not to be thought
of—and so the court was packed to acquit.
A body that subordinates its dignity to the supremacy of a party
cannot long retain that awe-inspiring respect so necessary to its
existence. Our House of Lords should bear in mind that the only
reason—if such it may be called—for its existence, is in this dignity.
If the Senate is not the holy, embalmed mummy of a dead king once
known as State sovereignty, it is naught; therefore, when a Senator
endangers this title to existence by unseemly conduct, either as an
inebriate or as a bribe-taker, he should be incontinently expelled.
The expulsion should be conducted with great ceremony. He should
be divested of his robes in the presence of the august body—robes
being procured for the occasion. One might be borrowed from the
Supreme Court. Then the culprit should be conducted by two
assistant Sergeants-at-Arms, one having hold of each arm. The
Sergeant-at-Arms should march behind, bearing the mace. We
believe the Senate has that utensil; if not, that of the House of
Representatives could be procured. At the main entrance the
Sergeant-at-Arms should fetch the mace into a charge, and planting
the eagle in the small of the culprit's back, thrust him out. All the
while the chaplain, in a solemn but distinct voice, should read the
Service for the Dead. After, the presiding officer should give three
distinct raps of his ivory gavel, and say in joyous but decorous voice,
indicative of triumphant yet seemly satisfaction: "The expurgated
Senate will now proceed with the business of legislating for the
House of Representatives."
So necessary is dignity to the existence of this august body, that the
presiding officer should have an eye continually to it; and when a
Senator, in debate, makes himself ridiculous, he should at once be
called to order. When, for example, the Hon. Senator from Vermont
(Mr. Edmunds) gave his grotesque picture of a common American
laborer being possessed of a piano, and a wife in silk attire, in his
own cottage home, he should have been promptly called to order.
The presiding officer should have remarked that the picture, being
imperfect, was in a measure untrue, and as such could not be
entertained by the Senate. The Senator, however, has the privilege
of amending his sketch by saying that the laborer has not only the
luxury found in a piano and silk-clad wife, but a mortgage on the
premises. This, although improbable, is not impossible for a common
laborer; and if the Hon. Senator will vouch for the fact that he knows
one such, his statement may go on record for what it is worth.
This would serve to abridge the liberty of speech guaranteed to us
by the Constitution. But we must remember that the same larger
freedom exercised in a bar-room, or upon the streets, or on the floor
of the House of Representatives, is a menace to the dignity of the
Senate; and in view of this, freedom of speech is somewhat
circumscribed. When, therefore, the Hon. Senator from Indiana (Mr.
Voorhees) shakes his senatorial fist at the Hon. Senator from Kansas
(Mr. Ingalls), and calls him an anathematized offspring of a female
canine, or words to that effect, he fractures the dignity of the
Senate, and further adjudication does not turn on the truth of the
utterances as in a court, for we are forced to remember that it is
one-half of the sovereign State of Indiana shaking its fist at one half
of the sovereign State of Kansas. This is very like the old story of the
sheriff of Posey County, Kentucky, who being agitated in a robust
manner by an angry citizen, called on his assailant to desist, as he
was "shaking all Posey County."
How long the practical common-sense citizens of the United States
will submit to this worn-out superstition of a Senate is a question
that strikes every thoughtful mind. The body was born of a narrow
sectional feeling, long before steam navigation and railroads made
the continent more of one body than was a single colony before the
Revolution; and was a concession to State sovereignty, with the new
and accepted principle of home rule found in State rights. It further
confuses and demoralizes the civil rule of the majority under the
Constitution, as it gives to Rhode Island or Delaware the same
power held by New York or Pennsylvania.
It was believed by the framers of our government that it would be a
conservative body, and serve as a restraint upon the popular
impulses to be expected from the House. This has not proved to be
the fact. The tenure of office given a Senator is of such length that it
weakens the only control found in public opinion, and this august
body is more extravagant, corrupt, and impulsive than the more
popular body at the other end of the Capitol. If any one doubts this,
let such doubter follow any appropriation bill, say that highway
robbery called the River and Harbor Appropriation, or pensions, from
the House to the Senate.
The Senate has long since survived its usefulness, if it ever had any;
is to-day an object of contempt; and the sooner we have done with
it the better off we shall be.
OUR DIPLOMATIC ABSURDITY.
There is a deep-felt apprehension indulged in by a class of our
citizens over the grave diplomatic complication found in the dismissal
of Lord Sackville West, and the refusal on the part of Her Gracious
Majesty of England to refill the vacant post at Washington with
another lord. Our national dignity is menaced so long as Mr. Phelps,
envoy extraordinary and minister plenipotentiary residing at or near
St. James's, is permitted to remain. As soon as Sackville "got the
sack," to use a vulgar but expressive phrase, a reasonable time
should have been given Her Gracious Majesty to fill the place; and
failing, the Hon. Phelps should have been promptly recalled. This
would have been hard on the Hon. Phelps, but with our flag insulted
and our eagle scoffed at by an empty legation at the national capital,
the Hon. Phelps should have been prepared to wrap the star-
spangled banner about his diplomatic body and die—if need be—to
the fierce screams of the eagle. He might, after such a glorious
demise, have been consigned to that corner of Westminster Abbey
that Dean Stanley reserved for a distinguished American. It is true
that we, in common with the American people, have designated
Senator Ingalls as the one selected for that honor, and we are
prepared to kill him any time, and forward his remains to the spot,
provided the Westminster people are willing to receive them. But this
is carrying us from our diplomatic mutton.
Under the circumstances, it is a comfort to know that all this
apprehension of these sensitive citizens is quite uncalled for. This
because we have no diplomatic service, no diplomatic agents, and
therefore no complications to speak of.
The framers of our government, through some oversight, neglected
to supply us with a diplomatic service. They saw, it is true, no use
for such; nor was it possible to have a government as a trust, and
give it such powers.
The diplomatic service pertains exclusively to a personal
government. It originated in a sovereign delegating certain powers,
attributes of the crown, to official agents whose duty was to reside
near the courts of other sovereigns, keep a watchful eye upon their
movements, report the same to their masters, and, from time to
time, negotiate treaties of advantage to their own sovereigns. To
give these diplomatic agents dignity and influence they were clothed
with sufficient power to commit their sovereigns to their official acts.
This is not possible with us. The sovereignty in our great republic is
in the people; and it finds expression, in this direction, through the
Executive and Senate. It cannot be delegated. When, therefore, a
treaty is negotiated between us and any foreign power, it is
necessary to send a special envoy to Washington to deal with the
Executive. This has to be sanctioned by the Senate: and our absurd
House of Lords has served notice on the world that the President
himself cannot commit our government to any treaty.
Why, then, are our diplomatic agents, so called, sent abroad as
ministers? Ministers resident and chargés d'affaires are merely clerks
of the State Department—no more, no less—who are sent abroad to
play at being diplomatists and get laughed at by the courts they
approach.
The diplomatic corps of Europe, being an important part of their
several governments, is made up of men possessed of fine intellect
and great culture. To meet and associate with such, we send
prominent politicians who, being such, are ignorant of their own
government, its history and character, let alone those of Europe; and
they are tolerated from a good-natured wish to be agreeable, where
there is no profit in being otherwise. We do not suffer in this so
much from our lack of good breeding—for it is difficult for a
prominent American to be other than a gentleman—as we do from
the ignorance of our official agents. Ex-President Grant, for example,
in his famous trip round the world, posed at every court he
approached as a royal personage. General Badeau ("Adjutant-in-
waiting"), acting as grand master of ceremonies, arranged the
household, and exacted from all comers the etiquette due a
sovereign. If our good citizens could have known the ripple of
laughter and ridicule that followed the result, in which our great man
was spoken of as "the King of the Yankee Doodles," they would be
more ashamed than proud of the performance.
It is this ignorance of ourselves and our political fabric that places us
in a false position before the world. The clerk of the State
Department sent abroad by our government as a diplomatic agent,
instead of putting up at a hotel and opening an office in a common
business way, sets up an establishment and "takes on airs." As most
of the diplomatic business is done in a social way, he attempts to
entertain on a salary entirely inadequate to such work. As a court
costume is necessary—which means the sort of livery the diplomatic
agent affects in the presence of his own sovereign—and as we,
having no king, have no livery, our department clerk borrows one,
either from some European court or the theatre, and dances
attendance in that.
No man ever stood higher in the estimation of the world, on account
of his genius, than James Russell Lowell. That esteem was
considerably shaken, in the eyes of an admirer, when, calling on his
minister at London, he found the poet's slender legs encased in
tights, and his little body clad in a gorgeous coat covered with gold
buttons. Of course, Mr. Lowell could masquerade in any dress and
remain the brilliant poet and patriot; but the significance of this
livery, its shallow pretence and humble admission, made the admirer
sick.
The clerk of our State Department sent abroad under this state of
facts finds nothing to do. He is not interested in the business of the
foreign diplomatic corps; and if he were, his government has no
hand in the game, nor is the agent sufficiently instructed to take part
even were he interested. He is tolerated by those with whom he
comes in contact, and his strange associates repay their good-nature
by the amusement they get out of the poor fellow.
There is no provision in our government for such an absurdity. The
framers of our Constitution provided none; and if our recollection
serves us right, it was not until 1856 that Congress recognized its
existence by a law fixing the rank and compensation.
The thing ought to be abolished. When Andrew Jackson was first
elected President, he went to Washington fully resolved to put an
end to the absurd business. The politicians were too much for Old
Hickory—and so they are to-day too much for common-sense, the
letter and spirit of our government, and the dignity of our people.
With a House of Lords at home and a so-called diplomatic corps
abroad, we are an object of contempt from the rising of the sun till
the setting thereof.
THE PASSING SHOW.
Sensationalism in art, as in literature, no doubt has its uses. It
serves to present old truths in a new light, and by a startling
grouping of ascertained facts helps to overcome the inertia of the
average man and make him think. There is a value in novelty,
provided it is rightly used, which is an important aid to the
playwright or scenic artist. But where sensationalism is manifested
by a distortion of facts, a falsification of history, or a violation of the
principles of human nature, its effect is demoralizing both to the
artist and the spectator, the author and the reader. Such an
innovation has been attempted by Mr. Henry Irving and Miss Ellen
Terry in their presentation of "Macbeth" at the Lyceum Theatre,
London. It is excellent acting, faithful reproduction of historic
costumes, exquisite scenery, but—it is not Shakspere. Nor is it
human nature.
Had it been only occasional alterations of the dramatist's lines, or
even the unnecessary division of the play into six acts instead of
five, or the cutting out of some of the characters, the genius of
Irving and Terry might have been pardoned the perversion. But
when they attempt to represent the ambitious, plotting, fiendish
murderess whom Shakspere has depicted, as a loving, devoted wife,
who only seeks to further a little job of killing for the purpose of
promoting her husband's interests, they meet with an infallible critic
in the heart of every intelligent spectator. It is against human nature,
and no amount of wonderful declamation or scenic magnificence can
gloss it over. The purpose of art is to portray nature, to refine it if
you will, but never to contradict. Lovers of the drama will be bitterly
disappointed that Mr. Irving, after having devoted the best years of
his life to the former, should at this late day, for the mere sake of
innovation, resort to the latter.
Shakspere, the great philosopher of human nature as well as the
greatest dramatist of the centuries, knew full well that unlawful
ambition which includes crime excludes the tender, womanly
devotion of the true wife, and, far from picturing Lady Macbeth as
an admirer of her husband, shows her as sneering at him for his
want of courage:
"Yet do I fear thy nature;
Is too full o' the milk of human kindness."
"Hie thee hither,
That I may pour my spirits in thine ear."
And this:
"We fail.
But screw your courage to the sticking-place."
Irving and Terry's play is not human nature and is not Shakspere;
but, overlooking these points, their conception is well carried out. It
is a wonderful spectacle. The resources of stage machinery have
been taxed to their utmost, and the English press is one chorus of
admiration at the marvellous landscapes, and at the quaint
ornamentation and the low, groined arches of the old Saxon castle.
It is a pity that these valuable adjuncts were not called unto the aid
of a more correct interpretation of the great ideal.
And now we are likely to have an epidemic of Macbeths. Margaret
Mather has tried it at Niblo's, and Mrs. Langtry has been incubating
a new presentation, like Terry's, with a "few innovations." Irving's
reputation as a stage manager is such that when his "Macbeth"
comes to America everyone will want to see it.
But will it ever come to America? For now, forsooth, there are some
members of the dramatic profession in this country who avow their
intention of appealing to Congress to regulate American taste by
law, and to exclude foreign actors under the contract-labor statute.
This brilliant idea originated in the fertile brain of Mr. Louis Aldrich,
and was nursed by the Actors' Order of Friendship. Into this Order
Messrs. Booth and Barrett were initiated with darkened windows and
mysterious rites, for the express purpose of fixing the stamp of their
approval upon the scheme. A delegation appeared before
Congressman Ford's Immigration Committee and begged that the
proposed undemocratic exclusion law shall contain a provision
against the landing of foreign pauper actors.
But these gentlemen lacked in logic what they possessed in
assurance. They were willing to except "stars" from the operation of
the law. Well, why not exclude "stars"? Do they not compete quite
as much with American talent as the humbler aspirants of the stage?
Even a "star" of the magnitude of Louis Aldrich himself would
probably find his rays outshone in the presence of the brighter
effulgence of an Irving or a Coquelin. It is the "stars" who compete
most with native talent, and on this principle they should be the first
excluded. Besides that, if they are excepted, who is to define a
"star"? It would be amusing to see the Supreme Court of the United
States gravely sitting in judgment on such a question. By all means,
Mr. Aldrich, return at once to Washington and amend your petition.
Let Mr. Ford include "stars" also in his bill. And then let every
protectionist crank in the country have absolute exclusion of every
possible competitor and of all kinds of goods that he wants to sell,
and pay a bounty to the farmers for their crops, and then we shall all
be able to raise ourselves by our boot-straps into a region of perfect
happiness.
Of course there are two sides to every question, and, not wishing to
do an injustice, we will give the one maintained by the petitioners.
We have a law prohibiting the importation of labor contracted for
abroad. This law the courts hold is applicable to cooks, coachmen,
and ministers of the Gospel. Now why should an exception be made
in behalf of a theatrical manager who contracts for a lot of actors,
more or less cheap, in London, to play for him in the United States?
Mr. Aldrich does not ask that the man, be he star or stock, who
comes of his own motives shall be prohibited; but he does protest
against the importation of the cheap histrionic labor which is brought
here, precisely as other skilled or unskilled labor is got over, to
compete with the same labor in the United States. In other words, it
is not a question of taste, but one of bread.
Another fact is overlooked that has a decided bearing on the
question. In all matters of art we are such a set of snobs that we
cannot recognize any merit in our artists until after they have been
indorsed by English critics and English audiences. If any law can be
enacted to correct this miserable condition, let us have it at an early
day. We know that the greatest actress known to the English-
speaking world—our Clara Morris—has failed to secure the fame and
fortune to which her genius entitled her simply because she
neglected to secure English approbation—which would have been
heartily given her had she ever appeared in London.
Nor is it true that English stock is preferred to the American product
because of its superior excellence. Mr. Daly has shown the absurdity
of this claim by taking his admirable company to London and
carrying off the honors. In the face of this and every other fact, we
are told that the English comedian doing the society drama is
superior to ours because of his superior social position. That is
something to be relegated to the things which amuse. There is an
adaptability about the American that makes him at home in all
conditions. It is possible for an American actor to wear a dress suit
with an ease that is rivalled only by the French. What is the good of
calling on an Englishman to do on the stage what no Englishman can
accomplish in private life? If there is a John Bull on earth who can
wear a dress suit with ease and elegance, he has not yet been
discovered.
There now, we have given both sides.
Mr. Edwin Booth offered his brother-actors a much better kind of
protection when, on New Year's Eve, he presented to them "The
Players'" club-house, with its fine library and its treasures of
dramatic art. After all, education and self-development are the only
legitimate means of attaining success; and he who offers his fellow-
beings facilities for improvement and self-help is a far greater
benefactor to them than he who endeavors to apply restrictive
methods. Such an institution has been Mr. Booth's dream for years.
It is a spacious house at No. 16 Gramercy Place, adjoining the
residence of the late Samuel J. Tilden. Mr. Booth purchased it for
$75,000, and spent $125,000 in alterations. The library is probably
the finest collection of dramatic literature in the world. Twelve
hundred volumes were presented by Mr. Booth, and two thousand
by Lawrence Barrett, besides a large number of rare works given by
Augustin Daly, T. B. Aldrich, Laurence Hutton, and others. It was a
touching scene when, a few moments before the old year died, Mr.
Booth placed in the hands of Augustin Daly for the Players' Club the
title-deeds to this magnificent property, and blushing like a girl
before the assembled actors, listened awkwardly to the simple words
which Mr. Daly spoke in reply. Then just after the midnight bells had
rung he turned and lit the Yule log, and the players began the
enjoyment of their new home.
A few days afterwards Mr. Booth closed his very successful
metropolitan engagement at the Fifth Avenue Theatre with "The
Fool's Revenge," Lawrence Barrett appearing in "Yorick's Love," and
both the tragedians started on a Southern tour.
Miss Mary Anderson appears in a late issue of a sensational
publication as a severe censor of society ladies addicted to attempts
upon the stage. We say Mary Anderson; for her name appears at the
end of the article, and as she is a woman, we will not venture to say
that the property claimed is not her own. Some rude critics have
charged that Mary did not make this up out of her own fair head;
and throughout the profession a state of mind exists that is not
complimentary to the would-be authoress.
The queerest part of the business, however, is, that such strictures
should come from Miss Anderson. She raided the stage as a society
woman, and struck at once for the honors. There was, if we
remember rightly, no long, weary preparation and laborious training
for the footlights. She went from the parlor to the greenroom, and
she went in with a flourish. She was of Kentucky birth, and Henry
Watterson, whose bright intellect is only surpassed by his good
heart, not only indorsed the ambitious society girl, but made up his
mind to put Mary down the American throat whether the people
would or not. Mary was not unpalatable to the American taste, but
Watterson is her father—that is, dramatically speaking.
Then Stepfather Griffin came in. Stepfather Griffin was born a
theatrical advance and advertising agent. He did not know this. If we
were to dwell on what Stepfather Griffin does not know, we should
fill all the space of this magazine for the year.
P. Griffin "caught on" to the provincial condition of our artistic,
literary, and dramatic life, which makes the approval of England
necessary to American success. So Poppy G. transported his
American star to London. He found the Prince of Wales necessary;
and Labouchere, M. P. and proprietor of Truth, taught the paternal
agent how to work the oracle. The Prince of Wales is a corpulent,
good-natured son of Her Gracious Majesty who rules all the earth
save Ireland. He is ever open to the advances and blandishments of
an American woman, or African woman, or any sort of woman,
provided she is lovely; and being approached, he expressed his
desire to know the star of Columbia. "Now," said Labouchere,
"having got that far, the thing to startle England and capture
Americans is for Mary to decline an introduction on high moral and
republican grounds." This was done, and Great Britain was startled
and the Yankee Doodles were captured. She returned to her native
land with an English troupe, and made Yankee Doodle go wild.
Now Mary is absolutely the worst actress ever sent sweeping from
the drawing-room to the footlights. Possessed of a tall, angular
figure, and blessed with a sonorous and in some respects pliable
voice, she has the fatal gift of imitation. No actor can win the
highest honors of his exalted profession who is a mimic. The actor
capable of giving expression to the thought of his author really
assists that author in the creation of a character. He or she is the
creator. Now the mimic is one who reproduces second-hand the
work of others. We are cursed with a traditionary assortment of
characters that have come down to us from the Kembles; and any
one capable of filling what Shakspere or Bacon or somebody called
the rôle of "a poor player who struts and frets his hour upon the
stage, and then is heard no more" can win applause through
mimicry, but never be great. We first saw Mary as Meg Merrilies, and
the reproduction of Cushman was something marvellous. And so we
have had it ever since. As Fechter said of Booth's Hamlet, that "he
played everybody's Hamlet but his own," so it may be said of Miss
Anderson, that she reproduces in an acceptable way the wearisome
line of old characters that have come to be stage properties.
Mrs. James Brown Potter, who has been playing to New York and
Brooklyn audiences in Tom Taylor's heavy drama, "'Twixt Axe and
Crown," shows considerable improvement over her acting of one
year ago, but she chose a very inappropriate piece for her
reappearance. Mrs. Potter reads her lines very well, is a very
beautiful woman, and possesses that indispensable adjunct of the
modern actress, a very handsome wardrobe. But she is not fitted for
the part of Lady Elizabeth, who in her youthful prison exhibits the
same wilful capriciousness and headstrong pride that she afterwards
showed on England's throne. Mr. Kyrle Bellew as Edward Courtenay,
the romantic lover of Elizabeth, played his rôle quite well. Mrs. Potter
is naturally better suited to fragile, feminine, girlish parts than she is
to the heroic, and there is plenty of room for improvement; but she
is painstaking, persistent, and has time before her.
Edward Harrigan's drama of "The Lorgaire," the only new play of the
month, is a passable sketch of Irish life. It is much more ingeniously
devised than any of his previous efforts in this line, and since it was
first put upon the stage has been much improved, many offensive
lines being eliminated.
Adolph Müller's new comic opera, "The King's Fool," was first
witnessed by an American audience in Chicago at the Columbia
Theatre on Christmas Eve. Its scene is laid at the court of
Pampeluna, and the plot is the development of a conspiracy to
secure the succession to the throne, the rightful heir being brought
up as a girl, the Salic law forbidding the accession of females. The
king's fool discovers the imposition, the young prince regains his
throne, and the conspirators are punished.
A very enjoyable selection of pieces has been put on the boards at
Daly's Theatre, including "The Lottery of Love," "Needles and Pins,"
"She Would and She Wouldn't," and "Rehearsing a Tragedy." Ada
Rehan scored her usual successes. Daly's Theatre is one where the
spectator is always sure of a pleasant evening's entertainment. At
the Standard "Miss Esmeralda" replaced "Monte Cristo, Jr." The new
play was in every way brighter and wittier, and offered more
opportunities to the talents of Nellie Farren and the admirable Gaiety
Company. Margaret Mather in her repertoire produced at Niblo's
Garden shows steady improvement. She makes a lovely Juliet, but in
the difficult part of Peg Woffington she is a failure. The "Yeomen of
the Guard" is withdrawn from the Casino, not from any lack of
popular favor, but because Manager Aronson has been obliged by a
contract to restore "Nadjy" to the stage. Herr Junkermann has been
giving several very creditable presentations at the new Amberg
Theatre, to the delight of our German citizens.
Most admirable, yet most difficult and incomplete, was the first
production in America of Wagner's "Rheingold" at the Metropolitan
Opera House early in January. The stage machinery was very
complicated, and the illusions were perfect. As the curtain rose the
depths of the Rhine waters appeared to fill the scene, the sun's
struggling rays caused the precious gold to gleam; and the three
Rhine maidens appointed by Wotan to watch it were seen gracefully
swimming about the treasure. From this novel opening to the close,
when the gods cross the rainbow bridge that leads to Walhalla, the
scenery was a marvel of spectacular effect, but it did not rise to the
excellence of the displays at the Bayreuth festivals. The orchestra
was in best form, and the singing was the best that has been
presented this season—much better, for instance, than in the
previous performance of "Siegfried," where Herr Alvary's voice
showed signs of wear, and Emil Fischer actually became hoarse
before the close.
"Faust," "The Huguenots," "L'Africaine," and "Fidelio" were among
the musical triumphs of the Metropolitan. Handel's "Messiah" was
beautifully given at the same theatre by the Oratorio Society, with
the Symphony Society's orchestra, under the direction of Walter
Damrosch; while concerts by the Boston Symphony orchestra, by
Theodore Thomas, and by Anton Seidl complete the list of delightful
musical entertainments of the season.
REVIEWS.
The Cloven Hoof under Petticoats: The Quick or the Dead; Eros; Miss
Middleton's Lovers.—The characteristic American novel of the day
might be described as an episode clothed in epigram. It is commonly
little more than an incident, slight as to plot, startling in contrasts of
light and shade, and too often avowedly immoral in tone—a
fragment of canvas, with ragged edges, cut at random from a
picture by Gérôme, with figures questionably suggestive, and
volcanic in color. It affects a myopic realism in details, not seldom of
the sort which, with non-committal suavity, we have agreed to call
"improper." It is nothing if not erotic. It deals with humanity from
the anatomist's standpoint, and describes, with insistence and
reiteration, the physical attributes of its characters, leaving the
spiritual to be inferred from their somewhat indefinite actions, and
that sort of mental sauntering which is termed analysis, for want of
a better name. It sets its women before you in the language of the
slave-market. It leaves no doubt in your mind that they are female—
female to a fault. "You could not help feeling in her presence that
she was a woman; the atmosphere was redolent with her. You never
so much as thought of her as a human being, a sentient, reasoning
personage like yourself. She was born to be a woman solely, and she
fulfilled her destiny." "She was sensuous and voluptuous. You
received from her a powerful impression of sex." "She was a naked
goddess—a pagan goddess, and there was no help for it." Realistic
this may indeed be, but it is hardly chivalrous, or consistent with
that respect which well-bred and sound-hearted men feel, or, for the
convenience of social intercourse, affect to feel toward that half of
human nature to which the mothers, sisters, and wives of the race
belong. A woman must be philosophical indeed who can accept as a
flattering testimony to her personal graces such a phrase as "She is
the most appetizing thing I have seen." To be regarded in the light
of a veal cutlet may possess the charm of gastronomic reminiscence,
but as a metaphor it is scarcely poetic.
In reading this class of fiction one is constrained to wonder what
these ingenious weavers of verbal tapestries would have done for
plot and incident—such as they are—had the Seventh
Commandment been eliminated from the Tables of the Law. It is a
never-failing well-spring, a Fortunatus' pocket, a theme more rich in
variations than the Carnival of Venice; and it is amazing as well as
instructive to the uninitiated to discover in how many original and
striking ways a wife may be unfaithful to her husband, and what
startling and dramatic situations may be evolved out of the
indiscretions of a too confiding society-girl. But even the
unmentionable has limits: the glacial smile of the nimblest ballet-
dancer may lose somewhat of its fascination in the course of time;
and in the overheated atmosphere of the "passionate" novel may
lurk the faintest intimations of a yawn.
The fact is, this multiform, many-worded element in current fiction is
not true passion at all. It is a theatrical presentation, often well set
and brilliantly costumed; but too frequently you see the paint and
hear the prompter calling forgotten cues from the wings. It is keen,
witty, cynical; but it is not real. It is daring, flippantly defiant,
paroxysmal, and redundant in explosive adjectives; but it is not true
to nature. It is as different from the genuine, living human emotion
as the impetuous, fervid, and unpremeditated love-making of a
youth is from the cold-blooded, carefully-rounded, and artificial
gallantries of an aged suitor. Real passion is always poetic; there is a
delicacy in its very vehemence, and if reprehensible from the
moralist's point of view, it is never contemptible. Simulated passion,
on the other hand, is always coarse and undignified—even when, as
in the case with many of these novels, expressed in graceful and
smoothly-flowing sentences; often absurd and flavored with covert
cynicism, as if it despised itself and its object. Actual passion is
almost entirely wanting in American fiction. The purer school of
James and Howells makes no pretence of it,—ignoring its existence
in human nature, as if men and women were sentient shapes of ice,
—and wisely, too; for though the lack of it in romance is a fatal
defect, it is better than a poor imitation. Nathaniel Hawthorne, that
isolated giant, drew from the mysterious depths of his own great
soul almost the only example of true passion in the literature of this
country. "The Scarlet Letter" towers aloft like the Olympian Jove
among terra-cotta statuettes, perhaps the noblest work of fiction
ever written. Here is passion, almost awful in its intensity;
suppressed, confined; struggling like a chained Titan, and at length
breaking loose and overwhelming itself beneath its own agony and
despair—passion, beautiful with youth and hope, star-eyed, crowned
with amaranth and clad in blood-red garments; led onward by his
dark brothers, Sin and Death, in swift tumultuous flight, toward his
unknown goal in the land of eternal shadows.
Compared with this lordly poem, the erotic novel of the day, with its
prurient platitudes, is as a satyr to Hyperion. Putting aside all
question of the moral law in the relation of the sexes, is there not
something foolishly undignified in these gasping, gurgling
adjectives? "Soul-scorching, flesh-melting flame of his eyes."
"Flammeous breath, sweeping her cheek, stirred her nature with a
fierce, hungerous yearning." "Ignescent passion." "Gloating upon her
hungerly." "Gives her whole body a comprehensive voluptuous
twist." "All entangled in her sweet sinuous embrace." "Languorously
inviting."—But we pause upon the verge of the unquotable, daunted,
stifled, in this mephitic atmosphere.
This is called Realism!—this affected posturing, at which good-taste
veils the face to hide the smile of contempt or the blush of common
decency—these ale-house stories transplanted to the drawing-room!
Is there—is there nothing in that love, whose very name lingers
upon the lips like a song—that love which has inspired all poetry, all
romance from the beginning of time; which has thrown down
embattled walls, taken strong cities, changed the boundaries of
empires, marshalled armed thousands upon memorable fields of
blood; which in every age has nerved men to great deeds and
rewarded them for great sacrifices; the sunrise hope of youth, the
evening meditation of the old, the spirit of home, the tender light
which gleams about the hearth-stone, the glory of the world;—is
there nothing, then, in this but the blind impulse which draws animal
to animal—which attracts the groping inhabitants of the mire and
the shapeless swimming lumps of the sea? If it be so, then thrice
sacred is that art which has power to throw a mist of glamour about
this hideous reality, and make it seem beautiful to our eyes! Far
better the divine lie than such truth! But it is not true: for real love,
even though it pass the pale of the law, and real passion, though it
tempt to sin, have about them always an inexpugnable dignity; and
if condemned, it is not with laughter or disgust.
The erotic in American fiction is a recent and exotic growth, not
native to the soil. It is therefore unhealthy and unwholesome. It is
out of place in this cold northern air. In its own climate it is a gaudy
flower; in this temperate zone it is a poisonous, spotted lily, rank of
smell and blistering to the touch. The licentiousness of Théophile
Gautier is elevated by the power of his transcendent genius to the
plane of true art. In America it sinks into a denizen of the gutter.
A remarkable feature of this noxious development is the prominent
part taken in it by women. It is somewhat startling to find upon the
title-page of a work whose cold, deliberate immorality and cynical
disregard of all social decency have set the teeth on edge, the name
of a woman as the author. We are so accustomed to associate
modesty of demeanor, delicacy of thought and word, and purity of
life with woman, that a certain set of adjectives, expressive of virtue
and morality, have come to include the idea of femininity in their
signification. It is certainly surprising, if not repellent, to find women
the most industrious laborers in the work of tearing down the
structure of honor and respect for their sex, which has so long been
regarded as the basis of social existence. If this breaking of the holy
images be but another manifestation of the revolt of women against
the too narrow limits of ancient prejudice, it is only additional proof
that misguided revolution easily becomes mere anarchy. While the
dispensation which would confine women to the nursery and
kitchen, and exclude them from broader fields of action, is happily a
dead letter, it is quite certain that no condition of civilization,
however liberal, will ever justify loose principles or lax manners, or
what is almost as reprehensible and much more despicable, the
cynicism which sneers at virtue while it prudently keeps its own
skirts unsoiled. But it is probable that the women who write this kind
of fiction are misled by vanity, rather than actuated by evil impulses.
They imagine that in thus throwing off all restraint they are giving
evidence of originality of thought and force of character; whereas
they are, in fact, courting unworthy suspicion and winning only that
sort of applause which is thinly veiled contempt.
In America social licentiousness is not inherent as a national
characteristic, nor inherited from a profligate ancestry. Whatever his
practice may be, the ordinary American is theoretically moral. He
recognizes moral turpitude, at least to the extent of dreading
exposure of his own backslidings. If he break the law, he
nevertheless insists upon the sanctity of the law. In a word, the
social atmosphere is pure and wholesome, though perhaps a little
chilly; and if anyone happens to be the proprietor of a nuisance, he
is very careful to keep it well concealed from his neighbors, and
neutralize the evil odor with lavish sprinklings of perfumery.
With us Licentiousness is not a gayly-clad reveller, a familiar figure at
feasts and pleasure parties, taking his share in the festivities,
dancing, laughing, and frisking as bravely as any. He is not a jovial
Bohemian, of too free life perhaps, but not half a bad fellow—a
careless, reckless, roaring blade. On the contrary, he is a dark,
shadowy, saturnine personage: a loiterer in lonely places, a lover of
the night, skulking around corners and hiding his face in a ready
mask. He dreads the law, for he knows that if detected his
companions of yesterday will bear witness against him to-day, and
lend their aid to set him in the stocks, to be jeered at by all the
world. He is thin-blooded and pale; he shudders at the sound of his
own footsteps, and shrinks from his own shadow. He knows no
songs in praise of Gillian and the wine-cup, and if he did he would
never dare sing them. He dresses in the seedy remains of a once
respectable suit; he is an outcast, a beggar, a vagabond, down at
the heels and owned by nobody. Altogether, he is as miserable and
forlorn a wretch as one would care to see, and his alter ego is
hypocrisy.
For this reason the licentious in American literature is and must be
cold, artificial, and repugnant. The erotic becomes mere bald
immorality, without grace, gayety, color, or warmth to lend it dignity
or render it tolerable. In the opulent, fervid period of the
Renaissance, art was born of passion and inspired by it to greatness.
The erotic was a legitimate element of all works of the imagination,
because it was a part of the social life of the day, and because,
being genuine, it could be made beautiful. When, after the
Revolution in England and the spread of Calvinism on the Continent,
the minds and manners of men were brought under closer restraint,
licentiousness in art began to be no longer natural and spontaneous,
and therefore no longer legitimate, until in the last century it
degenerated into simple indecency. When the erotic ceased to be
quite as much a matter of course, in fiction or poetry, as hatred,
jealousy, or revenge, and the reader learned to pass it over with a
frown or pick it out with a relish, according to his natural disgust of
or morbid craving for the impure, it became a blemish. It was no
longer real, but an indecent imitation. Compare "Romeo and Juliet,"
that divine poem of passion, with the abominations of Waters and
Rochester, popular in their day, but now happily forgotten, or even
Wycherly, not yet quite forgotten, and mark how wide the difference
between the true and the false, the natural and the unnatural.
To-day, in America at least, the physical is subordinate to the
spiritual. The mind is master, and the body in its bondage, if not
enfeebled, has at least become trained to passive obedience. All
impulses are submitted to the severe scrutiny of reason. Categories
of right and wrong, or perhaps the politic and the impolitic, are
strictly adhered to. Caution is largely in the ascendant. The world's
opinion is an ever-present restraining element. All these are results,
or at any rate concomitants of a loftier civilization. A society guided
by moral and intellectual forces is unquestionably upon higher
ground than one dominated by the physical. The world is, moreover,
a more comfortable place to live in than it used to be when, on
account of the color of the feather in one's hat, one must unsheathe
and go at it, hammer and tongs, to save one's skin.
Passion does still exist in the human heart, but it is restrained and
modified by the necessities and conditions of the social life of the
day. To be a fit element of fiction it must be depicted in its
nineteenth-century guise—in other words, decently. To be a truthful
picture it can be depicted in no other way. To exhibit it posturing,
writhing, and gasping in mere hysteria is to lower it beneath the
standard of wholesome and worthy art. License without love, and
immorality without passion, are as unpardonable in a novel as they
are in human nature.
Political Oratory of Emery A. Storrs, by Isaac E. Adams (Belford,
Clarke & Co.).—The compiler of Mr. Storrs's political speeches begins
his introductory chapter with some questionable generalizations
which are belittling and somewhat unjust to the large class of true
orators to which his hero belongs. He says: "Few examples of
political oratory have been embalmed in literature. Men, too,
remembered for oratorical power are easily reckoned, and tower
conspicuously along the shores of time. There was once a
Demosthenes, once a Cicero, once a Burke. The time will come
when, looking back upon the centuries of American history, it will be
said there was, also, once a Webster and once a Lincoln."
We must be permitted to observe that the line cannot be clearly
drawn between political and other oratory. In a broad sense, all the
great orators known to history have been political orators, because
they gained their fame chiefly in discussing the great and absorbing
public questions of their day.
To these belongs Emery A. Storrs. Let a few extracts from this
volume of speeches suffice to show the style of his oratory. At
Chicago, in the darkest hours of our civil war, he said: "I have no
doubt but that this, the most wicked rebellion that ever blackened
the annals of history, will be ground to powder. I have no doubt but
that our national integrity will be preserved. I have no doubt but that
the union of these States will be restored, and that the nation will
emerge from the fiery trial through which it has passed, brighter and
better and stronger than it has ever been before. It would be
impossible, however, that a conflict mighty as that from which we
are now, I trust, emerging should not leave its deep and permanent
impress upon our future national character. It will give tone to our
politics, our literature, and our feelings as a people, for ages to
come."
At Cleveland, in the campaign of 1880, he said: "Have you seen any
trouble with the pillars of the government? The trouble was not with
the pillars—they did not rock; the trouble was with the gentlemen
who were looking at the pillars of the government. They were like
the gentleman who had been attending a lecture on astronomy.
Going home loaded with a great deal of Democratic logic, with a
step weary and uncertain, with the earth revolving a great many
times upon its axis, he affectionately clasped a lamp-post and said,
'Old Galileo was right about it: the world does move.'"
The logic of Mr. Storrs's speeches on war topics, which were
immensely popular, is embraced in the single sentence: "I think
there can be nothing more suicidal than to intrust into the hands of
these men, who sought the destruction of our national life, the
direction of our national interests."
Hence the convenient 300-page volume under review will be
valuable to political speakers and writers who want their party zeal
warmed up by the earnest appeals of an impassioned, conscientious,
and clear-minded orator. The diction of Mr. Storrs is admirable, his
language is almost always felicitous, and in his logic there is a happy
blending of grace and force. If his range was not wide, he was
always able to concentrate learning and ability enough on any given
occasion to show a masterful oratorical power over immense masses
of men.
A STORM ASHORE.[5]
By James H. Connelly.
I.
WHERE THE DEED WAS DONE.
Three quarters of a century ago, when Sag Harbor was an important
whaling port, and before railroads were even dreamed of on that
remote part of Long Island, there were dotted along the eastern
shore only a few quaint little villages, already old, with a small
population scattered in their vicinity, consisting almost entirely of a
hardy race, who, though professedly cultivators of the soil, in reality
drew most of their subsistence from arduous and often perilous toil
upon the sea. Among the curiously inscribed tombstones in the
graveyards, where even then six generations were lying, were not at
all unfrequent those that bore the legend "killed by a whale." Of the
younger men in the community, there were few who did not aspire
to go abroad as whalers, and their elders, though settled
agriculturists nominally, or even petty tradesmen, had generally
"been a-whaling," loved to spin yarns about their cruises, and were
still more than semi-nautical in speech, manners, and industries.
They naturally spoke of "the bow" of a horse, or his "port-quarter,"
as occasion might require; belonged to shore whaling companies;
fished for the New York market to a limited extent, and perhaps did
some smuggling; as shore-living people, in those days, generally
seemed to think they had an inherent right to. In their little "sitting-
rooms" were many curious and interesting things, brought from far
distant lands, such as broad branches of fan coral, stuffed birds of
brilliant plumage, strange shells and sperm whales' teeth adorned
with queer rude pictures scratched upon them by sailors whose
thoughts of loved ones at home had prompted them to such artistic
endeavor.
Between the villages were long reaches of woodland, or perhaps it
would be more correct to say thicket--broken here and there, where
the sandy soil seemed to give most promise, by tilled fields. Fierce
gales, through the long hard winter months, dealt cruelly with the
scrubby cedars and knotty little oaks in those woods, gnarling their
boughs, twisting their trunks, and stunting their growth, so that not
all the genial breath of spring, nor the ardent summer's sun could
quite repair the damage wrought them in the season of ice and
storm. But the hardy trees stood close together, as if seeking
support and consolation from each other in their hours of trial, when
they creaked and ground complaint to one another; so close that
their interlaced foliage kept always damp the leaf-strewn ground
beneath, where the fragrant trailing arbutus bloomed in earliest
spring, and the tangled whortleberry bushes later bore their clusters
of bluish-purple fruit. Here and there the dwarfed forest sloped
gently down to broad expanses of salt meadow, where snipe and
plover found their favorite feeding grounds among the rank rushes
and long grass, or the soft marshy slime, except when the full moon
tides came rushing through the little inlets between the white round
sand dunes on the beach and, whelming the lowland, snatched
brown-leaf trophies from the very edges of the wood. On the knolls
between these meadows were favorite places for the location of the
homes of the earlier settlers, among whom were the Van Deusts.
The Van Deust homestead was one of the oldest dwellings on that
portion of the island, and those who at this time inhabited it were
the direct descendants of other Van Deusts, whose remote existence
and remarkable longevity were alike attested by the quaintly graven
tombstones in the ancient graveyard of the village, a mile away.
It was a rambling one-story house, built of small logs covered with
boards now warped and rusty from age, but both roomy and
comfortable as well as picturesque. Those by whom it was erected
loved better the sea than the land, for they had not only sought out
this, the most commanding site they could obtain for its location, but
had turned its back upon the forest and the lane, and reared its
broad porch upon the side facing the ocean. Here, in the ample
shade, the two old bachelor brothers, its present occupants,
inheriting as well the feeling as the property of their ancestors, loved
to linger. The ceaseless roar of the waves was in their ears a wild
tumultuous music, and their eyes were never weary of the ever-
changing beauty and glory of the world of billows, blushing with the
dawn, laughing with the noon, and frowning beneath storm and
night. Three broad and rugged elm trees shaded the porch, and one
gable of the house was rasped by the boughs of the nearest tree of
a thickly grown and badly cared for little orchard. Bats and swallows
flitted undisturbed in the summer evenings to and from the low loft
of the old homestead, through its various chinks and refts; native
song-birds build their nests and reared their young under the eaves,
and in the swinging branches of the venerable elms; bees buzzed
among the thick honeysuckle, and clematis vines that twined about
the pillar of the porch, and threw their long sprays in flowery
festoons between; and when the busy hum of those industrious little
toilers ceased at nightfall, the crickets' cheery chirp, from among the
rough stones of the old-fashioned fireplace within, took up the
refrain of insect melody. Neither insect, bird, nor beast feared the
two kindly old men who inhabited that home. One of the brothers
loved all living things, and was at peace with all, and the other was
like unto him, with the sole exception that he liked not women, nor
was willing to be at peace with them. Yet he had never been
married!
Peter, the elder by a couple of years, was the woman hater, and to
such an extent did he carry his antipathy toward the sex, that he
would tolerate no other female servant about the house than old
black Betsy, who was the daughter of a couple of slaves his
grandfather had owned, and who thoroughly considered herself one
of the family, as indeed her indulgent masters regarded her. The
three old people occupied the house alone. Brother Jacob once
hinted to Peter that perhaps it might be as well to get a young
woman to assist old Betsy in her work, and his so doing brought on
what was more like a quarrel between him and Peter than anything
that had disturbed the monotony of their uneventful lives up to that
time. A compromise was finally effected, by virtue of which a
neighbor was engaged to come over for a couple of hours daily to
do such chores about the house as the brothers felt beyond their
strength, and to bring his wife along on Tuesdays to do the week's
washing and scrubbing. But on Tuesdays Peter always went a-
fishing, regardless of the weather, and was gone all day, so avoiding
sight of the neighbor's wife. Whatever the secret cause for his bitter
and contemptuous aversion to women may have been, he kept it to
himself. That they were fair to look upon, he denied not. "But," said
he, "they are wrecker lights, and the truer and better a man is, the
brighter they shine to lure him to the breakers. And look at yourself,
Jacob," he would add, when his brother ventured to mildly
expostulate against the vigor of his denunciations of the sex;
whereupon Jacob would turn away with a sigh, and the discussion
would be at an end.
Back of the house a narrow lane, bordered by a neglected garden
and a cornfield beyond, led out to the distant highway. The Van
Deust brothers were not poor, as the humble style of their home
might seem to indicate; indeed they had the reputation, in all the
country around, of being wealthy, and were, at least, well off. The
neglect and indifference of age in its owners was the sole cause that
the surroundings of the old homestead, which might easily have
been made charming, presented such a picture of disorder and
decay.
Up the little lane, at a very early hour one bright summer morning,
two men might have been seen, driving in a light gig, approaching
the Van Deust mansion. One of them was a stout, ruddy-faced
gentleman, of fifty, or thereabouts, known to everybody in the
county as Squire Bodley. His companion, who held the reins, was a
handsome young fellow of twenty-four or twenty-five years, rustic in
personal appearance and garb, with a good frank open countenance
that bore a pleasing expression of intelligence and good nature.
"Of course it's only a form, my going to be your security," said the
older man, as they jogged along, "for the Van Deusts know you as
well as I do, and knew your father, Dave Pawlett, before you, and a
good man he was. But still, Lem, I don't know any young fellow in
all the country round about that I'd take more pleasure in serving,
even in a matter of form, than you."
"Thank you, sir," replied the young man warmly, with a grateful flush
upon his sun-burnt cheeks. "It's very kind of you, I'm sure, and I
can't tell you how much I feel it so. You know I want the lease of
that lower farm, but you don't know how almightily much I want it;
and nobody does but me and—one other person, perhaps."
"Aha!" responded the Squire, with a chuckle, "I can make a guess
about who the other person is. And some day you and that other
person will be coming to me for a little business in my line, I reckon,
—a sort of mutual life lease, eh?"
"Well, maybe so, Squire. I hope so," answered Lem, confusedly, and
with a little deeper flush, "But here we are at the gate. Wait a
moment, while I jibe the bow wheels and make the horse fast."
As he spoke, he jumped lightly out of the vehicle, turned the horse a
little to one side, so as to make the descent of his companion more
convenient, and, after hitching the reins to a fence-post,
accompanied the Squire to the door of the house. There was no
sound, or sign, as yet, of any of the inmates of the old homestead
being astir.
"Well, they must be late risers here," soliloquized the Squire, as Lem
rapped and called at the door.
At the end of a few minutes, a voice answered indistinctly from
within: "Who's there? What d'ye want?" And almost immediately
after, the shutters on the window of a little extension of the house,
at the end farthest from the orchard, were pushed open, and the
head of an aged black woman appeared with the echoing query,
"Who dah? Wha' dy'e wan'?"
"It's me—Squire Bodley," responded that gentleman, answering the
first inquirer.
Presently the door opened and Peter Van Deust appeared in it; a
weazened, thin little man, with a fringe of gray hair surrounding a
big white bald place on the top of his head, with a well-formed nose
and eyes still bright enough to suggest that he had been a good-
looking young fellow in his day; with lips that quivered, and long
lean fingers that trembled with the weakness of old age; but, withal,
a pleasant smile and a cheery ring, even yet, in his cracked old
voice.
"Why, Squire!" he exclaimed, as he threw open the door, "I'm real
glad to see you. And Lem! You, too? Well, this is a pleasant surprise-
party for us early in the morning!"
"It's not so very early, Peter," answered the Squire. "It is almost
seven o'clock."
"Is that so? Well, I declare! I wonder why Jacob isn't up. He's mostly
an early riser, and as he's the boy amongst us, why we old folks—
Betsy and me—rely on him to wake us up in the mornings. Old
people, you know, get back to being like babies again for wanting
their good sleep. But Jacob has overslept himself this morning, sure.
I'll soon roust him out, though."
As he spoke he went to a closed door at one side of the central
sitting-room, which was flanked by the separate apartments of the
brothers, and pounding upon it with his bony knuckles, called:
"Come, Jacob, bounce out, boy! You're late! It's breakfast time, and
we've got visitors. Get up!"
There was no answering sound from within. He waited a moment,
then knocked again, shouting: "Hello, Jacob! Jake! I say, get up!
What' the matter with you?"
Still there was no response. The three men waiting, held their breath
to listen, and a vague sense of uneasiness crept over them. The
songs of the blue-birds, and the chirp of the martens; the humming
of the bees; the stamping of the horse hitched to the gig, and the
clatter old Betsy made in opening her door, were all sharply distinct
in the quiet summer morning air; but from the closed room there
was no sound whatever. Peter tried the door, but it did not yield.
"He's locked his door!" exclaimed the old man, with an intonation of
surprise in his voice.
"Maybe something has happened to him," suggested Lem.
"What could happen to him? He was all right last night; never better
in his life. And he's younger than me. But it's queer he should have
locked his door. He don't mostly." He continued rapping and shouting
"Jacob, wake up!" in a more and more anxious tone.
"The key isn't in the keyhole, I guess," he muttered half to himself,
fumbling at the lock with a bit of stick he picked up from the floor,
"but," stooping down and trying to peer through, "I can't see
anything, because it's all dark inside."
"Haven't you some other key about the house that will fit the lock?"
asked the Squire.
"Yes. Mine does, I guess. But I didn't think of it at first. I'll try it."
It fitted: the bolt was thrown back, and the door pushed open. The
sunshine darted in and fell, broad and clear, upon a still and ghastly
thing that laid in the middle of the floor—the corpse of an old man,
surrounded by a pool of blood.
Peter gave a wild cry of horror, and fell back senseless into the arms
of Lem Pawlett, who was close behind him. They laid him on the old
hair-cloth sofa in the sitting-room, called Betsy to attend to him, and
then passed into the chamber he had opened.
Murder had been done. Jacob Van Deust's skull had been beaten in
by some heavy instrument. One terrible crushing blow had mashed
in his left temple, and let out his little weak old life; but, as if for
very lust of killing the assassin had struck again and again, and the
skull was fractured in several places. The old man, it appeared, had
risen from his bed to meet his murderer, and had been struck down
before he could utter a cry of alarm. The window curtains were
down, so that the room was as yet only lighted from the door; but
when those in front were opened, and a flood of sunlight poured in,
there were no evidences apparent that there had been any struggle
between the slayer and his victim, nor were there at once visible any
indications that robbery, the only cause readily conceivable for the
brutal murder of such an inoffensive old man, had been the purpose
instigating the crime. The contents of the bureau drawers were
much tumbled and disordered, but it was presumable that they were
so usually, through the careless habits of the occupant of the
apartment. There were no marks of blood upon anything they
contained, but it was evident that the murderer had made some
attempt at least to wipe his crimsoned hands upon the old man's
shirt after killing him, and that was probably before he searched the
bureau, if indeed he had troubled himself to ransack it at all. On one
pillow of the bed they found the mark of a bloody hand. Perhaps the
assassin was in such haste for plunder that he groped where the old
man's head had lain before thinking of his bloody hand. Beyond that
nothing appeared to them to show that robbery had been done.
But when Peter Van Deust had sufficiently recovered to be able to
speak coherently, he said that his brother habitually kept,
somewhere in his room, a wallet containing something over three
thousand dollars, and a bag of coin; how much he did not know.
These were nowhere to be found.
Lem Pawlett was hastily dispatched by the Squire, soon after the
discovery of the crime, to summon some near neighbors; and as he
drove rapidly along the road, shouting to every person he saw
—"Jacob Van Deust has been murdered!"—it was but a very little
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

More Related Content

Similar to Developers Guide Borland Delphi 7 For Windows Borland Software Corporation (20)

PDF
Ibm enterprise it and asset management 7.1 java for customization training
Hal Izi
 
PDF
Introduction to Programming Using Java v. 7 - David J Eck - Inglês
Marcelo Negreiros
 
PDF
Javanotes6 linked
Sandile Mabika
 
PDF
Ibm enterprise it and asset management 7.1 java for customization exercise
Hal Izi
 
PDF
E views 9 command ref
Ibrahima Bakhoum
 
PDF
javanotes5.pdf
kmspega
 
PDF
Csharp
guestb9fa55
 
PDF
[Ebooks PDF] download C How to Program 1ST Edition Harvey M. Deitel full chap...
raaenvalko0u
 
PDF
W java81
rasikow
 
PDF
advanced java.pdf
Ali Bozkurt
 
PDF
Oop c++ tutorial
Nigus Zinabu
 
PDF
(eTextbook PDF) for Starting out with Visual C# 5th Edition
biswssjhutty
 
PDF
data structures
Sai Lakshmi Cheedella
 
PDF
C Plus Plus The Complete Reference 4th Ed Www Amaderforum Com
Anil Mishra
 
PDF
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
moldtkhanizw
 
PDF
Programming C 50 Building Windows 8 Web And Desktop Applications For The Net ...
starsleunk
 
PDF
Arm assembly language by Bournemouth Unversity
Stephan Cadene
 
PDF
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
anryabrica
 
PDF
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
crancegaisie
 
PDF
R Ints
Ajay Ohri
 
Ibm enterprise it and asset management 7.1 java for customization training
Hal Izi
 
Introduction to Programming Using Java v. 7 - David J Eck - Inglês
Marcelo Negreiros
 
Javanotes6 linked
Sandile Mabika
 
Ibm enterprise it and asset management 7.1 java for customization exercise
Hal Izi
 
E views 9 command ref
Ibrahima Bakhoum
 
javanotes5.pdf
kmspega
 
Csharp
guestb9fa55
 
[Ebooks PDF] download C How to Program 1ST Edition Harvey M. Deitel full chap...
raaenvalko0u
 
W java81
rasikow
 
advanced java.pdf
Ali Bozkurt
 
Oop c++ tutorial
Nigus Zinabu
 
(eTextbook PDF) for Starting out with Visual C# 5th Edition
biswssjhutty
 
data structures
Sai Lakshmi Cheedella
 
C Plus Plus The Complete Reference 4th Ed Www Amaderforum Com
Anil Mishra
 
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
moldtkhanizw
 
Programming C 50 Building Windows 8 Web And Desktop Applications For The Net ...
starsleunk
 
Arm assembly language by Bournemouth Unversity
Stephan Cadene
 
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
anryabrica
 
Starting Out with C++: Early Objects 9th Edition by Tony Gaddis (eBook PDF)
crancegaisie
 
R Ints
Ajay Ohri
 

Recently uploaded (20)

PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PPTX
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
Cybersecurity: How to Protect your Digital World from Hackers
vaidikpanda4
 
PPTX
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
PPTX
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
PPTX
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
PPT
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
INTESTINALPARASITES OR WORM INFESTATIONS.pptx
PRADEEP ABOTHU
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Cybersecurity: How to Protect your Digital World from Hackers
vaidikpanda4
 
Top 10 AI Tools, Like ChatGPT. You Must Learn In 2025
Digilearnings
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
The Future of Artificial Intelligence Opportunities and Risks Ahead
vaghelajayendra784
 
Basics and rules of probability with real-life uses
ravatkaran694
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Digital Professionalism and Interpersonal Competence
rutvikgediya1
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
I INCLUDED THIS TOPIC IS INTELLIGENCE DEFINITION, MEANING, INDIVIDUAL DIFFERE...
parmarjuli1412
 
ENGLISH 8 WEEK 3 Q1 - Analyzing the linguistic, historical, andor biographica...
OliverOllet
 
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
Ad

Developers Guide Borland Delphi 7 For Windows Borland Software Corporation

  • 1. Developers Guide Borland Delphi 7 For Windows Borland Software Corporation download https://ebookbell.com/product/developers-guide-borland- delphi-7-for-windows-borland-software-corporation-36903922 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Delphi 7 For Windows Developers Guide Borland https://ebookbell.com/product/delphi-7-for-windows-developers-guide- borland-6773342 Borland Delphi 6 Developers Guide Steve Teixeira Xavier Pacheco https://ebookbell.com/product/borland-delphi-6-developers-guide-steve- teixeira-xavier-pacheco-6760318 Delphi 6 For Windows Developers Guide Borland https://ebookbell.com/product/delphi-6-for-windows-developers-guide- borland-6760192 Developers Guide Delphi 6 For Windows https://ebookbell.com/product/developers-guide-delphi-6-for- windows-1021628
  • 3. Borland C Builder 6 Developers Guide 2nd Jarrod Hollingworth https://ebookbell.com/product/borland-c-builder-6-developers- guide-2nd-jarrod-hollingworth-983154 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 Developers Guide To Collections In Microsoft Net Calvin Janes https://ebookbell.com/product/developers-guide-to-collections-in- microsoft-net-calvin-janes-2371386 Developers Guide To Web Application Security Michael Cross https://ebookbell.com/product/developers-guide-to-web-application- security-michael-cross-4099920
  • 5. Developer’sGuide Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 www.borland.com Borland® Delphi™ 7 for Windows®
  • 6. Refer to the DEPLOY document located in the root directory of your Delphi 7 product for a complete list of files that you can distribute in accordance with the Delphi 7 License Statement and Limited Warranty. Borland Software Corporation may have patents and/or pending patent applications covering subject matter in this document. Please refer to the product CD or the About dialog box for the list of applicable patents. The furnishing of this document does not give you any license to these patents. COPYRIGHT © 1983–2002 Borland Software Corporation. All rights reserved. All Borland brand and product names are trademarks or registered trademarks of Borland Software Corporation in the United States and other countries. All other marks are the property of their respective owners. Printed in the U.S.A. HDE1370WW21001 7E5R0802 0203040506-9 8 7 6 5 4 3 2 1 D3
  • 7. iii Chapter 1 Introduction 1-1 What’s in this manual? . . . . . . . . . . . . . . 1-1 Manual conventions . . . . . . . . . . . . . . . . 1-2 Developer support services. . . . . . . . . . . . 1-3 Part I Programming with Delphi Chapter 2 Developing applications with Delphi 2-1 Integrated development environment. . . . . . 2-1 Designing applications . . . . . . . . . . . . . . 2-2 Creating projects . . . . . . . . . . . . . . . . . . 2-3 Editing code . . . . . . . . . . . . . . . . . . . . 2-4 Compiling applications . . . . . . . . . . . . . . 2-4 Debugging applications. . . . . . . . . . . . . . 2-5 Deploying applications . . . . . . . . . . . . . . 2-5 Chapter 3 Using the component library 3-1 Understanding the component library . . . . . 3-1 Properties, methods, and events . . . . . . . 3-3 Properties . . . . . . . . . . . . . . . . . . 3-3 Methods . . . . . . . . . . . . . . . . . . . 3-4 Events . . . . . . . . . . . . . . . . . . . . 3-4 User events . . . . . . . . . . . . . . . . . 3-4 System events . . . . . . . . . . . . . . . . 3-4 Internal events . . . . . . . . . . . . . . . 3-4 Objects, components, and controls. . . . . . . . 3-5 TObject branch . . . . . . . . . . . . . . . . . 3-6 TPersistent branch . . . . . . . . . . . . . . . 3-7 TComponent branch . . . . . . . . . . . . . . 3-7 TControl branch . . . . . . . . . . . . . . . . 3-9 TWinControl/TWidgetControl branch . . .3-10 Chapter 4 Using the object model 4-1 What is an object? . . . . . . . . . . . . . . . . . 4-1 Examining a Delphi object . . . . . . . . . . 4-2 Changing the name of a component . . . . . 4-4 Inheriting data and code from an object. . . . . 4-5 Scope and qualifiers . . . . . . . . . . . . . . . . 4-5 Private, protected, public, and published declarations . . . . . . . . . . . . . . . . . . 4-6 Using object variables . . . . . . . . . . . . . . . 4-7 Creating, instantiating, and destroying objects . . . . . . . . . . . . . . . . . . . . . . . 4-8 Components and ownership . . . . . . . . . . 4-9 Defining new classes . . . . . . . . . . . . . . . . 4-9 Using interfaces . . . . . . . . . . . . . . . . . . 4-12 Using interfaces across the hierarchy . . . . 4-13 Using interfaces with procedures . . . . . . 4-14 Implementing IInterface . . . . . . . . . . . 4-14 TInterfacedObject . . . . . . . . . . . . . . . 4-15 Using the as operator with interfaces . . . . 4-16 Reusing code and delegation. . . . . . . . . 4-16 Using implements for delegation . . . . 4-17 Aggregation . . . . . . . . . . . . . . . . 4-18 Memory management of interface objects. . . . . . . . . . . . . . . . . . . . . 4-18 Using reference counting . . . . . . . . . 4-19 Not using reference counting. . . . . . . 4-20 Using interfaces in distributed applications . . . . . . . . . . . . . . . . . 4-21 Chapter 5 Using BaseCLX 5-1 Using streams . . . . . . . . . . . . . . . . . . . . 5-2 Using streams to read or write data . . . . . . 5-2 Stream methods for reading and writing. . . . . . . . . . . . . . . . . . . . 5-2 Reading and writing components . . . . . 5-3 Reading and writing strings . . . . . . . . 5-3 Copying data from one stream to another . . . . . . . . . . . . . . . . . . . . . 5-4 Specifying the stream position and size. . . . 5-4 Seeking to a specific position . . . . . . . . 5-4 Using Position and Size properties . . . . 5-5 Working with files . . . . . . . . . . . . . . . . . 5-5 Approaches to file I/O . . . . . . . . . . . . . 5-6 Using file streams . . . . . . . . . . . . . . . . 5-6 Creating and opening files using file streams . . . . . . . . . . . . . . . . . 5-7 Using the file handle . . . . . . . . . . . . 5-8 Manipulating files. . . . . . . . . . . . . . . . 5-8 Deleting a file. . . . . . . . . . . . . . . . . 5-8 Finding a file . . . . . . . . . . . . . . . . . 5-8 Renaming a file. . . . . . . . . . . . . . . 5-10 File date-time routines . . . . . . . . . . 5-10 Copying a file . . . . . . . . . . . . . . . 5-11 Contents
  • 8. iv Working with ini files and the system Registry . . . . . . . . . . . . . . . . . . . . . . 5-11 Using TIniFile and TMemIniFile . . . . .5-12 Using TRegistryIniFile . . . . . . . . . . .5-13 Using TRegistry. . . . . . . . . . . . . . .5-13 Working with lists . . . . . . . . . . . . . . . . .5-14 Common list operations . . . . . . . . . . . .5-15 Adding list items . . . . . . . . . . . . . .5-15 Deleting list items. . . . . . . . . . . . . .5-15 Accessing list items . . . . . . . . . . . . .5-16 Rearranging list items . . . . . . . . . . .5-16 Persistent lists. . . . . . . . . . . . . . . . . .5-16 Working with string lists . . . . . . . . . . . . .5-17 Loading and saving string lists . . . . . . . .5-17 Creating a new string list . . . . . . . . . . .5-18 Short-term string lists . . . . . . . . . . .5-18 Long-term string lists. . . . . . . . . . . .5-18 Manipulating strings in a list . . . . . . . . .5-20 Counting the strings in a list. . . . . . . .5-20 Accessing a particular string . . . . . . .5-20 Locating items in a string list . . . . . . .5-20 Iterating through strings in a list . . . . .5-20 Adding a string to a list . . . . . . . . . .5-21 Moving a string within a list. . . . . . . .5-21 Deleting a string from a list . . . . . . . .5-21 Associating objects with a string list . . .5-22 Working with strings . . . . . . . . . . . . . . .5-22 Wide character routines . . . . . . . . . . . .5-22 Commonly used long string routines . . . .5-23 Commonly used routines for null-terminated strings. . . . . . . . . . . .5-26 Declaring and initializing strings. . . . . . .5-27 Mixing and converting string types . . . . .5-28 String to PChar conversions. . . . . . . . . .5-28 String dependencies . . . . . . . . . . . .5-29 Returning a PChar local variable . . . . .5-29 Passing a local variable as a PChar . . . .5-29 Compiler directives for strings . . . . . . . .5-30 Creating drawing spaces . . . . . . . . . . . . .5-31 Printing . . . . . . . . . . . . . . . . . . . . . . .5-32 Converting measurements . . . . . . . . . . . .5-33 Performing conversions . . . . . . . . . . . .5-33 Performing simple conversions . . . . . .5-33 Performing complex conversions . . . . .5-33 Adding new measurement types . . . . . . .5-34 Creating a simple conversion family and adding units . . . . . . . . . . . . . . .5-34 Declare variables . . . . . . . . . . . . . .5-35 Register the conversion family . . . . . .5-35 Register measurement units . . . . . . . 5-35 Use the new units . . . . . . . . . . . . . 5-35 Using a conversion function . . . . . . . . . 5-36 Declare variables. . . . . . . . . . . . . . 5-36 Register the conversion family . . . . . . 5-36 Register the base unit . . . . . . . . . . . 5-36 Write methods to convert to and from the base unit . . . . . . . . . . . . 5-36 Register the other units . . . . . . . . . . 5-37 Use the new units . . . . . . . . . . . . . 5-37 Using a class to manage conversions . . . . 5-37 Creating the conversion class. . . . . . . 5-38 Declare variables. . . . . . . . . . . . . . 5-39 Register the conversion family and the other units . . . . . . . . . . . . . . 5-39 Use the new units . . . . . . . . . . . . . 5-40 Defining custom variants . . . . . . . . . . . . 5-40 Storing a custom variant type’s data . . . . 5-41 Creating a class to enable the custom variant type. . . . . . . . . . . . . . . . . . 5-42 Enabling casting . . . . . . . . . . . . . . 5-42 Implementing binary operations. . . . . 5-44 Implementing comparison operations. . . . . . . . . . . . . . . . . 5-46 Implementing unary operations . . . . . 5-47 Copying and clearing custom variants . . . 5-48 Loading and saving custom variant values. . . . . . . . . . . . . . . 5-49 Using the TCustomVariantType descendant . . . . . . . . . . . . . . . . 5-50 Writing utilities to work with a custom variant type. . . . . . . . . . . . . . . . . . 5-50 Supporting properties and methods in custom variants . . . . . . . . . . . . . . 5-51 Using TInvokeableVariantType . . . . . 5-51 Using TPublishableVariantType . . . . . 5-53 Chapter 6 Working with components 6-1 Setting component properties . . . . . . . . . . . 6-2 Setting properties at design time . . . . . . . 6-2 Using property editors . . . . . . . . . . . 6-3 Setting properties at runtime. . . . . . . . . . 6-3 Calling methods. . . . . . . . . . . . . . . . . . . 6-3 Working with events and event handlers . . . . 6-3 Generating a new event handler. . . . . . . . 6-4 Generating a handler for a component’s default event . . . . . . . . . . . . . . . . . . 6-4 Locating event handlers . . . . . . . . . . . . 6-4
  • 9. v Associating an event with an existing event handler. . . . . . . . . . . . . . . . . . . . . 6-5 Using the Sender parameter . . . . . . . . 6-5 Displaying and coding shared events . . 6-5 Associating menu events with event handlers . . . . . . . . . . . . . . . . . . . . 6-6 Deleting event handlers . . . . . . . . . . . . 6-6 Cross-platform and non-cross-platform components . . . . . . . . . . . . . . . . . . . . 6-7 Adding custom components to the Component palette . . . . . . . . . . . . . . 6-9 Chapter 7 Working with controls 7-1 Implementing drag and drop in controls . . . . 7-1 Starting a drag operation . . . . . . . . . . . 7-1 Accepting dragged items . . . . . . . . . . . 7-2 Dropping items . . . . . . . . . . . . . . . . . 7-3 Ending a drag operation. . . . . . . . . . . . 7-3 Customizing drag and drop with a drag object. . . . . . . . . . . . . . . . . . 7-3 Changing the drag mouse pointer . . . . . . 7-4 Implementing drag and dock in controls . . . . 7-4 Making a windowed control a docking site . . . . . . . . . . . . . . . . . . 7-4 Making a control a dockable child . . . . . . 7-5 Controlling how child controls are docked. . . . . . . . . . . . . . . . . . . 7-5 Controlling how child controls are undocked . . . . . . . . . . . . . . . . . 7-6 Controlling how child controls respond to drag-and-dock operations . . . . . . . . 7-6 Working with text in controls. . . . . . . . . . . 7-6 Setting text alignment . . . . . . . . . . . . . 7-7 Adding scroll bars at runtime. . . . . . . . . 7-7 Adding the clipboard object. . . . . . . . . . 7-8 Selecting text . . . . . . . . . . . . . . . . . . 7-9 Selecting all text . . . . . . . . . . . . . . . . 7-9 Cutting, copying, and pasting text . . . . . .7-10 Deleting selected text . . . . . . . . . . . . .7-10 Disabling menu items . . . . . . . . . . . . . 7-11 Providing a pop-up menu . . . . . . . . . . . 7-11 Handling the OnPopup event. . . . . . . . .7-12 Adding graphics to controls . . . . . . . . . . .7-13 Indicating that a control is owner-drawn . . . . . . . . . . . . . . . . .7-13 Adding graphical objects to a string list . . 7-14 Adding images to an application . . . . 7-14 Adding images to a string list . . . . . . 7-14 Drawing owner-drawn items. . . . . . . 7-15 Sizing owner-draw items. . . . . . . . . . . 7-16 Drawing owner-draw items . . . . . . . . . 7-17 Chapter 8 Building applications, components, and libraries 8-1 Creating applications. . . . . . . . . . . . . . . . 8-1 GUI applications. . . . . . . . . . . . . . . . . 8-2 User interface models . . . . . . . . . . . . 8-2 SDI applications . . . . . . . . . . . . . . . 8-2 MDI applications. . . . . . . . . . . . . . . 8-2 Setting IDE, project, and compiler options . . . . . . . . . . . . . . . . . . . 8-3 Programming templates . . . . . . . . . . . . 8-3 Console applications . . . . . . . . . . . . . . 8-4 Service applications . . . . . . . . . . . . . . . 8-5 Service threads . . . . . . . . . . . . . . . . 8-7 Service name properties. . . . . . . . . . . 8-9 Debugging service applications . . . . . . 8-9 Creating packages and DLLs . . . . . . . . . . 8-10 When to use packages and DLLs . . . . . . 8-11 Writing database applications . . . . . . . . . . 8-11 Distributing database applications . . . . . 8-12 Creating Web server applications . . . . . . . . 8-12 Creating Web Broker applications . . . . . . 8-13 Creating WebSnap applications . . . . . . . 8-14 Creating Web Services applications . . . . . 8-14 Writing applications using COM . . . . . . . . 8-15 Using COM and DCOM . . . . . . . . . . . 8-15 Using MTS and COM+ . . . . . . . . . . . . 8-15 Using data modules . . . . . . . . . . . . . . . 8-16 Creating and editing standard data modules. . . . . . . . . . . . . . . . . 8-16 Naming a data module and its unit file . . . . . . . . . . . . . . . . . . 8-17 Placing and naming components . . . . 8-18 Using component properties and events in a data module . . . . . . . . . 8-18 Creating business rules in a data module . . . . . . . . . . . . . . . . . . 8-19 Accessing a data module from a form . . . 8-19 Adding a remote data module to an application server project. . . . . . . . . . 8-20
  • 10. vi Using the Object Repository . . . . . . . . . . .8-20 Sharing items within a project . . . . . . . .8-20 Adding items to the Object Repository . . .8-21 Sharing objects in a team environment . . .8-21 Using an Object Repository item in a project. . . . . . . . . . . . . . . . . . .8-21 Copying an item . . . . . . . . . . . . . .8-21 Inheriting an item. . . . . . . . . . . . . .8-22 Using an item . . . . . . . . . . . . . . . .8-22 Using project templates . . . . . . . . . . . .8-22 Modifying shared items . . . . . . . . . . . .8-22 Specifying a default project, new form, and main form . . . . . . . . . . . . . . . .8-23 Enabling Help in applications . . . . . . . . . .8-23 Help system interfaces. . . . . . . . . . . . .8-24 Implementing ICustomHelpViewer . . . . .8-24 Communicating with the Help Manager . . . . . . . . . . . . . . . . . . . .8-25 Asking the Help Manager for information . . . . . . . . . . . . . . . . . .8-25 Displaying keyword-based Help . . . . . . .8-26 Displaying tables of contents . . . . . . . . .8-27 Implementing IExtendedHelpViewer . . . .8-27 Implementing IHelpSelector . . . . . . . . .8-28 Registering Help system objects . . . . . . .8-29 Registering Help viewers . . . . . . . . .8-29 Registering Help selectors . . . . . . . . .8-29 Using Help in a VCL application. . . . . . . . .8-30 How TApplication processes VCL Help . . .8-30 How VCL controls process Help . . . . . . .8-30 Using Help in a CLX application. . . . . . . . .8-31 How TApplication processes CLX Help . . .8-31 How CLX controls process Help . . . . . . .8-31 Calling a Help system directly . . . . . . . . . .8-32 Using IHelpSystem . . . . . . . . . . . . . . . .8-32 Customizing the IDE Help system. . . . . . . .8-33 Chapter 9 Developing the application user interface 9-1 Controlling application behavior. . . . . . . . . 9-1 Working at the application level . . . . . . . 9-2 Handling the screen . . . . . . . . . . . . . . 9-2 Setting up forms . . . . . . . . . . . . . . . . . . 9-3 Using the main form . . . . . . . . . . . . . . 9-3 Hiding the main form . . . . . . . . . . . . . 9-3 Adding forms . . . . . . . . . . . . . . . . . . 9-4 Linking forms . . . . . . . . . . . . . . . . 9-4 Avoiding circular unit references . . . . . 9-4 Managing layout . . . . . . . . . . . . . . . . 9-5 Using forms . . . . . . . . . . . . . . . . . . . . . 9-6 Controlling when forms reside in memory . . . . . . . . . . . . . . . . . . . 9-6 Displaying an auto-created form. . . . . . 9-6 Creating forms dynamically . . . . . . . . 9-7 Creating modeless forms such as windows . . . . . . . . . . . . . . . . . 9-8 Creating a form instance using a local variable . . . . . . . . . . . . . . . . . . . 9-8 Passing additional arguments to forms . . . . 9-8 Retrieving data from forms. . . . . . . . . . . 9-9 Retrieving data from modeless forms . . . 9-9 Retrieving data from modal forms. . . . 9-11 Reusing components and groups of components . . . . . . . . . . . . . . . . . . . 9-13 Creating and using component templates . . . 9-13 Working with frames . . . . . . . . . . . . . . . 9-14 Creating frames . . . . . . . . . . . . . . . . 9-14 Adding frames to the Component palette. . . . . . . . . . . . . . . . . . . . . 9-15 Using and modifying frames. . . . . . . . . 9-15 Sharing frames. . . . . . . . . . . . . . . . . 9-16 Developing dialog boxes. . . . . . . . . . . . . 9-17 Using open dialog boxes . . . . . . . . . . . 9-17 Organizing actions for toolbars and menus . . . . . . . . . . . . . . . . . . . . . . 9-18 What is an action? . . . . . . . . . . . . . . . 9-19 Setting up action bands. . . . . . . . . . . . 9-20 Creating toolbars and menus . . . . . . . . 9-20 Adding color, patterns, or pictures to menus, buttons, and toolbars . . . . 9-22 Adding icons to menus and toolbars . . . . . . . . . . . . . . . . . . 9-22 Selecting menu and toolbar styles . . . . 9-23 Creating dynamic menus . . . . . . . . . 9-24 Creating toolbars and menus that users can customize . . . . . . . . . . . 9-24 Hiding unused items and categories in action bands . . . . . . . . . . . . . . 9-24 Creating most recently used (MRU) lists . . . . . . . . . . . . . . . . 9-25
  • 11. vii Using action lists . . . . . . . . . . . . . . . . . .9-26 Setting up action lists . . . . . . . . . . . . .9-26 What happens when an action fires . . . . .9-27 Responding with events . . . . . . . . . .9-27 How actions find their targets. . . . . . .9-29 Updating actions . . . . . . . . . . . . . . . .9-29 Predefined action classes . . . . . . . . . . .9-30 Writing action components . . . . . . . . . .9-31 Registering actions . . . . . . . . . . . . . . .9-31 Creating and managing menus. . . . . . . . . .9-32 Opening the Menu Designer . . . . . . . . .9-33 Building menus. . . . . . . . . . . . . . . . .9-34 Naming menus . . . . . . . . . . . . . . .9-34 Naming the menu items . . . . . . . . . .9-34 Adding, inserting, and deleting menu items . . . . . . . . . . . . . . . .9-35 Adding separator bars . . . . . . . . . . .9-36 Specifying accelerator keys and keyboard shortcuts . . . . . . . . . . . .9-36 Creating submenus. . . . . . . . . . . . . . .9-37 Creating submenus by demoting existing menus . . . . . . . . . . . . . .9-37 Moving menu items . . . . . . . . . . . .9-38 Adding images to menu items . . . . . .9-38 Viewing the menu . . . . . . . . . . . . .9-39 Editing menu items in the Object Inspector. . . . . . . . . . . . . . . . . . . .9-39 Using the Menu Designer context menu . . . . . . . . . . . . . . . . . . . . . .9-40 Commands on the context menu . . . . .9-40 Switching between menus at design time . . . . . . . . . . . . . . . .9-41 Using menu templates . . . . . . . . . . . . .9-41 Saving a menu as a template . . . . . . . . .9-43 Naming conventions for template menu items and event handlers . . . . .9-44 Manipulating menu items at runtime . . . .9-44 Merging menus . . . . . . . . . . . . . . . . .9-44 Specifying the active menu: Menu property . . . . . . . . . . . . . . . . . .9-45 Determining the order of merged menu items: GroupIndex property . . .9-45 Importing resource files . . . . . . . . . . . .9-45 Designing toolbars and cool bars . . . . . . . .9-46 Adding a toolbar using a panel component. . . . . . . . . . . . . . . . . . .9-47 Adding a speed button to a panel. . . . .9-47 Assigning a speed button’s glyph. . . . .9-48 Setting the initial condition of a speed button . . . . . . . . . . . . . . . 9-48 Creating a group of speed buttons. . . . 9-48 Allowing toggle buttons . . . . . . . . . 9-49 Adding a toolbar using the toolbar component . . . . . . . . . . . . . . . . . . 9-49 Adding a tool button . . . . . . . . . . . 9-49 Assigning images to tool buttons . . . . 9-50 Setting tool button appearance and initial conditions . . . . . . . . . . 9-50 Creating groups of tool buttons . . . . . 9-51 Allowing toggled tool buttons . . . . . . 9-51 Adding a cool bar component . . . . . . . . 9-51 Setting the appearance of the cool bar . . . . . . . . . . . . . . . . . . 9-52 Responding to clicks . . . . . . . . . . . . . 9-52 Assigning a menu to a tool button. . . . 9-52 Adding hidden toolbars . . . . . . . . . . . 9-53 Hiding and showing toolbars . . . . . . . . 9-53 Demo programs . . . . . . . . . . . . . . . . 9-53 Common controls and XP themes. . . . . . . . 9-54 Chapter 10 Types of controls 10-1 Text controls . . . . . . . . . . . . . . . . . . . . 10-1 Edit controls . . . . . . . . . . . . . . . . . . 10-2 Edit control properties . . . . . . . . . . 10-2 Memo and rich edit controls . . . . . . . 10-3 Text viewing controls . . . . . . . . . . . . . 10-3 Labels . . . . . . . . . . . . . . . . . . . . . . 10-4 Specialized input controls . . . . . . . . . . . . 10-5 Scroll bars . . . . . . . . . . . . . . . . . . . 10-5 Track bars. . . . . . . . . . . . . . . . . . . . 10-5 Up-down controls . . . . . . . . . . . . . . . 10-6 Spin edit controls (CLX only) . . . . . . . . 10-6 Hot key controls (VCL only) . . . . . . . . . 10-6 Splitter controls . . . . . . . . . . . . . . . . 10-7 Buttons and similar controls. . . . . . . . . . . 10-7 Button controls. . . . . . . . . . . . . . . . . 10-8 Bitmap buttons . . . . . . . . . . . . . . . . 10-8 Speed buttons . . . . . . . . . . . . . . . . . 10-8 Check boxes . . . . . . . . . . . . . . . . . . 10-9 Radio buttons . . . . . . . . . . . . . . . . . 10-9 Toolbars. . . . . . . . . . . . . . . . . . . . . 10-9 Cool bars (VCL only) . . . . . . . . . . . . 10-10 List controls . . . . . . . . . . . . . . . . . . . 10-10 List boxes and check-list boxes . . . . . . .10-11 Combo boxes. . . . . . . . . . . . . . . . . .10-11 Tree views . . . . . . . . . . . . . . . . . . 10-12
  • 12. viii List views . . . . . . . . . . . . . . . . . . . 10-13 Icon views (CLX only) . . . . . . . . . . . . 10-13 Date-time pickers and month calendars. . . . . . . . . . . . . . . . . . . 10-13 Grouping controls . . . . . . . . . . . . . . . . 10-13 Group boxes and radio groups . . . . . . . 10-14 Panels . . . . . . . . . . . . . . . . . . . . . 10-14 Scroll boxes . . . . . . . . . . . . . . . . . . 10-14 Tab controls . . . . . . . . . . . . . . . . . . 10-15 Page controls . . . . . . . . . . . . . . . . . 10-15 Header controls. . . . . . . . . . . . . . . . 10-15 Display controls . . . . . . . . . . . . . . . . . 10-16 Status bars. . . . . . . . . . . . . . . . . . . 10-16 Progress bars . . . . . . . . . . . . . . . . . 10-16 Help and hint properties . . . . . . . . . . 10-17 Grids. . . . . . . . . . . . . . . . . . . . . . . . 10-17 Draw grids . . . . . . . . . . . . . . . . . . 10-17 String grids . . . . . . . . . . . . . . . . . . 10-17 Value list editors (VCL only) . . . . . . . . . . 10-18 Graphic controls . . . . . . . . . . . . . . . . . 10-19 Images . . . . . . . . . . . . . . . . . . . . . 10-19 Shapes . . . . . . . . . . . . . . . . . . . . . 10-19 Bevels . . . . . . . . . . . . . . . . . . . . . 10-19 Paint boxes . . . . . . . . . . . . . . . . . . 10-20 Animation control . . . . . . . . . . . . . . 10-20 Chapter 11 Designing classes and components with ModelMaker 11-1 ModelMaker fundamentals. . . . . . . . . . . . 11-2 ModelMaker models . . . . . . . . . . . . . . 11-2 Using ModelMaker with the IDE. . . . . . . 11-2 Creating models . . . . . . . . . . . . . . . . 11-3 Using ModelMaker views. . . . . . . . . . . . . 11-4 Collections pane . . . . . . . . . . . . . . . . 11-5 Classes view . . . . . . . . . . . . . . . . . 11-5 Units view . . . . . . . . . . . . . . . . . . 11-5 Diagrams view . . . . . . . . . . . . . . . 11-6 Members pane . . . . . . . . . . . . . . . . . 11-7 Editors pane. . . . . . . . . . . . . . . . . . . 11-7 Implementation Editor . . . . . . . . . . . 11-7 Unit Code Editor . . . . . . . . . . . . . . 11-8 Diagram Editor . . . . . . . . . . . . . . . 11-9 Other Editors . . . . . . . . . . . . . . . . 11-9 For more information . . . . . . . . . . . . . . 11-10 Chapter 12 Working with graphics and multimedia 12-1 Overview of graphics programming . . . . . . 12-1 Refreshing the screen . . . . . . . . . . . . . 12-2 Types of graphic objects . . . . . . . . . . . 12-3 Common properties and methods of Canvas . . . . . . . . . . . . . . . . . . . 12-4 Using the properties of the Canvas object . . . . . . . . . . . . . . . . . . . . . 12-5 Using pens . . . . . . . . . . . . . . . . . 12-5 Using brushes . . . . . . . . . . . . . . . 12-8 Reading and setting pixels . . . . . . . . 12-9 Using Canvas methods to draw graphic objects . . . . . . . . . . . . . . . 12-10 Drawing lines and polylines . . . . . . 12-10 Drawing shapes . . . . . . . . . . . . . .12-11 Handling multiple drawing objects in your application . . . . . . . . . . . . 12-12 Keeping track of which drawing tool to use . . . . . . . . . . . . . . . . 12-12 Changing the tool with speed buttons . . . . . . . . . . . . . . . . . 12-13 Using drawing tools . . . . . . . . . . . 12-14 Drawing on a graphic. . . . . . . . . . . . 12-16 Making scrollable graphics . . . . . . . 12-17 Adding an image control . . . . . . . . 12-17 Loading and saving graphics files. . . . . 12-19 Loading a picture from a file . . . . . . 12-19 Saving a picture to a file. . . . . . . . . 12-20 Replacing the picture . . . . . . . . . . 12-20 Using the clipboard with graphics . . . . 12-21 Copying graphics to the clipboard. . . 12-22 Cutting graphics to the clipboard . . . 12-22 Pasting graphics from the clipboard . . . . . . . . . . . . . . . . 12-23 Rubber banding example. . . . . . . . . . 12-24 Responding to the mouse . . . . . . . . 12-24 Responding to a mouse-down action . . . . . . . . . . . . . . . . . . 12-25 Adding a field to a form object to track mouse actions. . . . . . . . . 12-27 Refining line drawing . . . . . . . . . . 12-28
  • 13. ix Working with multimedia . . . . . . . . . . . 12-30 Adding silent video clips to an application. . . . . . . . . . . . . . . . . . 12-30 Example of adding silent video clips . . . . . . . . . . . . . . . . 12-31 Adding audio and/or video clips to an application . . . . . . . . . . . . . . 12-32 Example of adding audio and/or video clips (VCL only) . . . . . . . . . 12-33 Chapter 13 Writing multi-threaded applications 13-1 Defining thread objects . . . . . . . . . . . . . .13-2 Initializing the thread . . . . . . . . . . . . .13-3 Assigning a default priority . . . . . . . .13-3 Indicating when threads are freed . . . .13-4 Writing the thread function . . . . . . . . . .13-4 Using the main VCL/CLX thread. . . . .13-4 Using thread-local variables . . . . . . . .13-6 Checking for termination by other threads. . . . . . . . . . . . . . . .13-6 Handling exceptions in the thread function . . . . . . . . . . . . . . . . . .13-6 Writing clean-up code . . . . . . . . . . . . .13-7 Coordinating threads . . . . . . . . . . . . . . .13-7 Avoiding simultaneous access . . . . . . . .13-7 Locking objects . . . . . . . . . . . . . . .13-8 Using critical sections . . . . . . . . . . .13-8 Using the multi-read exclusive-write synchronizer . . . . . . . . . . . . . . . .13-8 Other techniques for sharing memory . . . . . . . . . . . . . . . . . .13-9 Waiting for other threads . . . . . . . . . . .13-9 Waiting for a thread to finish executing. . . . . . . . . . . . . . . . . 13-10 Waiting for a task to be completed . . . 13-10 Executing thread objects . . . . . . . . . . . . 13-12 Overriding the default priority . . . . . . . 13-12 Starting and stopping threads . . . . . . . 13-12 Debugging multi-threaded applications . . . 13-13 Naming a thread . . . . . . . . . . . . . . . 13-13 Converting an unnamed thread to a named thread . . . . . . . . . . . . . 13-13 Assigning separate names to similar threads. . . . . . . . . . . . . . 13-15 Chapter 14 Exception handling 14-1 Defining protected blocks . . . . . . . . . . . . 14-2 Writing the try block . . . . . . . . . . . . . 14-2 Raising an exception. . . . . . . . . . . . 14-3 Writing exception handlers. . . . . . . . . . 14-4 Exception-handling statements . . . . . 14-4 Handling classes of exceptions. . . . . . 14-6 Scope of exception handlers . . . . . . . 14-6 Reraising exceptions. . . . . . . . . . . . 14-7 Writing finally blocks . . . . . . . . . . . . . 14-8 Writing a finally block. . . . . . . . . . . 14-9 Handling exceptions in VCL applications . . . 14-9 VCL exception classes . . . . . . . . . . . 14-10 Default exception handling in VCL . . . . .14-11 Silent exceptions. . . . . . . . . . . . . . . 14-12 Defining your own VCL exceptions. . . . 14-13 Chapter 15 Developing cross-platform applications 15-1 Creating CLX applications . . . . . . . . . . . . 15-2 Porting VCL applications . . . . . . . . . . . . 15-2 Porting techniques . . . . . . . . . . . . . . 15-2 Platform-specific ports . . . . . . . . . . 15-3 Cross-platform ports . . . . . . . . . . . 15-3 Windows emulation ports . . . . . . . . 15-3 Modifying VCL applications. . . . . . . . . 15-4 WinCLX versus VisualCLX. . . . . . . . . . 15-5 What VisualCLX does differently . . . . 15-6 Features that do not port directly or are missing . . . . . . . . . . . . . . . . . . 15-7 Comparing WinCLX and VisualCLX units . . . . . . . . . . . . . . . 15-8 Differences in CLX object constructors . . .15-11 Handling system and widget events . . . 15-12 Writing portable code. . . . . . . . . . . . 15-12 Using conditional directives . . . . . . 15-13 Terminating conditional directives. . . 15-14 Including inline assembler code . . . . 15-15 Programming differences on Linux . . . . 15-16
  • 14. x Transferring applications between Windows and Linux . . . . . . . . . . . . . . 15-17 Sharing source files between Windows and Linux . . . . . . . . . . . . 15-17 Environmental differences between Windows and Linux . . . . . . . . . . . . 15-18 Registry . . . . . . . . . . . . . . . . . . 15-20 Look and feel . . . . . . . . . . . . . . . 15-20 Directory structure on Linux . . . . . . . . 15-20 Cross-platform database applications . . . . . 15-21 dbExpress differences . . . . . . . . . . . . 15-22 Component-level differences . . . . . . . . 15-22 User interface-level differences . . . . . . . 15-23 Porting database applications to Linux . . 15-24 Updating data in dbExpress applications . . . . . . . . . . . . . . . . . 15-26 Cross-platform Internet applications . . . . . 15-28 Porting Internet applications to Linux . . . 15-28 Chapter 16 Working with packages and components 16-1 Why use packages? . . . . . . . . . . . . . . . .16-2 Packages and standard DLLs . . . . . . . . .16-2 Runtime packages . . . . . . . . . . . . . . . . .16-3 Loading packages in an application . . . . .16-3 Loading packages with the LoadPackage function . . . . . . . . . . . . . . . . . .16-4 Deciding which runtime packages to use. . . . . . . . . . . . . . . . . . . . . .16-4 Custom packages. . . . . . . . . . . . . . . .16-5 Design-time packages . . . . . . . . . . . . . . .16-5 Installing component packages . . . . . . . .16-6 Creating and editing packages . . . . . . . . . .16-7 Creating a package . . . . . . . . . . . . . . .16-7 Editing an existing package . . . . . . . . . .16-8 Understanding the structure of a package . . . . . . . . . . . . . . . . . .16-8 Naming packages. . . . . . . . . . . . . .16-8 Requires clause . . . . . . . . . . . . . . .16-9 Contains clause . . . . . . . . . . . . . . .16-9 Editing package source files manually. . . 16-10 Compiling packages . . . . . . . . . . . . . 16-10 Package-specific compiler directives. . . . . . . . . . . . . . . . . 16-11 Compiling and linking from the command line . . . . . . . . . . . . 16-13 Package files created when compiling . . . . . . . . . . . . . . . . 16-13 Deploying packages . . . . . . . . . . . . . . 16-14 Deploying applications that use packages . . . . . . . . . . . . . . . . 16-14 Distributing packages to other developers . . . . . . . . . . . . . . . . . 16-14 Package collection files . . . . . . . . . . . 16-14 Chapter 17 Creating international applications 17-1 Internationalization and localization . . . . . . 17-1 Internationalization . . . . . . . . . . . . . . 17-1 Localization . . . . . . . . . . . . . . . . . . 17-2 Internationalizing applications . . . . . . . . . 17-2 Enabling application code . . . . . . . . . . 17-2 Character sets . . . . . . . . . . . . . . . 17-2 OEM and ANSI character sets . . . . . . 17-3 Multibyte character sets. . . . . . . . . . 17-3 Wide characters . . . . . . . . . . . . . . 17-4 Including bi-directional functionality in applications . . . . . . . . . . . . . . 17-4 BiDiMode property . . . . . . . . . . . . 17-4 Locale-specific features . . . . . . . . . . 17-7 Designing the user interface . . . . . . . . . 17-7 Text . . . . . . . . . . . . . . . . . . . . . 17-7 Graphic images . . . . . . . . . . . . . . 17-8 Formats and sort order . . . . . . . . . . 17-8 Keyboard mappings . . . . . . . . . . . . 17-8 Isolating resources. . . . . . . . . . . . . . . 17-8 Creating resource DLLs. . . . . . . . . . . . 17-9 Using resource DLLs . . . . . . . . . . . . 17-10 Dynamic switching of resource DLLs. . . .17-11 Localizing applications. . . . . . . . . . . . . 17-12 Localizing resources. . . . . . . . . . . . . 17-12 Chapter 18 Deploying applications 18-1 Deploying general applications . . . . . . . . . 18-1 Using installation programs . . . . . . . . . 18-2 Identifying application files . . . . . . . 18-2 Application files . . . . . . . . . . . . . . 18-3 Package files . . . . . . . . . . . . . . . . 18-3 Merge modules. . . . . . . . . . . . . . . 18-3 ActiveX controls . . . . . . . . . . . . . . 18-5 Helper applications . . . . . . . . . . . . 18-5 DLL locations. . . . . . . . . . . . . . . . 18-6 Deploying CLX applications. . . . . . . . . . . 18-6
  • 15. xi Deploying database applications. . . . . . . . .18-6 Deploying dbExpress database applications 18-7 Deploying BDE applications . . . . . . . . .18-8 Borland Database Engine . . . . . . . . .18-9 Deploying multi-tiered database applications (DataSnap). . . . . . . . . . . . . . . . . . .18-9 Deploying Web applications . . . . . . . . . . .18-9 Deploying on Apache servers . . . . . . . 18-10 Enabling modules. . . . . . . . . . . . . 18-10 CGI applications . . . . . . . . . . . . . 18-11 Programming for varying host environments 18-12 Screen resolutions and color depths . . . . 18-12 Considerations when not dynamically resizing . . . . . . . . . . . . . . . . . . 18-12 Considerations when dynamically resizing forms and controls . . . . . . . . . . . 18-13 Accommodating varying color depths . 18-14 Fonts . . . . . . . . . . . . . . . . . . . . . . 18-14 Operating systems versions . . . . . . . . . 18-15 Software license requirements . . . . . . . . . 18-15 DEPLOY. . . . . . . . . . . . . . . . . . . . 18-15 README . . . . . . . . . . . . . . . . . . . 18-16 No-nonsense license agreement . . . . . . 18-16 Third-party product documentation . . . . 18-16 Part II Developing database applications Chapter 19 Designing database applications 19-1 Using databases . . . . . . . . . . . . . . . . . .19-1 Types of databases . . . . . . . . . . . . . . .19-2 Database security. . . . . . . . . . . . . . . .19-4 Transactions. . . . . . . . . . . . . . . . . . .19-4 Referential integrity, stored procedures, and triggers . . . . . . . . . . . . . . . . . .19-5 Database architecture . . . . . . . . . . . . . . .19-6 General structure . . . . . . . . . . . . . . . .19-6 The user interface form. . . . . . . . . . .19-6 The data module . . . . . . . . . . . . . .19-6 Connecting directly to a database server. . . . . . . . . . . . . . . . . . . . . .19-8 Using a dedicated file on disk. . . . . . . . .19-9 Connecting to another dataset . . . . . . . 19-10 Connecting a client dataset to another dataset in the same application . . . . 19-12 Using a multi-tiered architecture . . . . 19-13 Combining approaches . . . . . . . . . . . 19-14 Designing the user interface . . . . . . . . . . 19-15 Analyzing data . . . . . . . . . . . . . . . 19-15 Writing reports. . . . . . . . . . . . . . . . 19-16 Chapter 20 Using data controls 20-1 Using common data control features . . . . . . 20-2 Associating a data control with a dataset . . . . . . . . . . . . . . . . . . . 20-3 Changing the associated dataset at runtime. . . . . . . . . . . . . . . . . 20-4 Enabling and disabling the data source . . . . . . . . . . . . . . . . . . . 20-4 Responding to changes mediated by the data source . . . . . . . . . . . . 20-4 Editing and updating data . . . . . . . . . . 20-5 Enabling editing in controls on user entry . . . . . . . . . . . . . . . . . 20-5 Editing data in a control. . . . . . . . . . 20-5 Disabling and enabling data display . . . . 20-6 Refreshing data display. . . . . . . . . . . . 20-7 Enabling mouse, keyboard, and timer events . . . . . . . . . . . . . . . . . 20-7 Choosing how to organize the data. . . . . . . 20-7 Displaying a single record . . . . . . . . . . 20-7 Displaying data as labels . . . . . . . . . 20-8 Displaying and editing fields in an edit box . . . . . . . . . . . . . . . . . . 20-8 Displaying and editing text in a memo control . . . . . . . . . . . . . . . . . . . 20-9 Displaying and editing text in a rich edit memo control . . . . . . . . . . . . 20-9 Displaying and editing graphics fields in an image control. . . . . . . . . . . 20-10 Displaying and editing data in list and combo boxes . . . . . . . . . . . . . . 20-10 Handling Boolean field values with check boxes . . . . . . . . . . . . . . . 20-13 Restricting field values with radio controls . . . . . . . . . . . . . . . . . 20-14 Displaying multiple records . . . . . . . . 20-14 Viewing and editing data with TDBGrid. . . 20-15 Using a grid control in its default state . . 20-16 Creating a customized grid. . . . . . . . . 20-17 Understanding persistent columns . . 20-17 Creating persistent columns . . . . . . 20-18 Deleting persistent columns . . . . . . 20-19 Arranging the order of persistent columns . . . . . . . . . . . . . . . . . 20-19
  • 16. xii Setting column properties at design time . . . . . . . . . . . . . . . . . . . . 20-20 Defining a lookup list column. . . . . . 20-21 Putting a button in a column . . . . . . 20-22 Restoring default values to a column . . . . . . . . . . . . . . . . . . 20-22 Displaying ADT and array fields . . . . . . 20-22 Setting grid options . . . . . . . . . . . . . 20-24 Editing in the grid . . . . . . . . . . . . . . 20-26 Controlling grid drawing . . . . . . . . . . 20-26 Responding to user actions at runtime. . . 20-27 Creating a grid that contains other data-aware controls . . . . . . . . . . . . . . 20-28 Navigating and manipulating records. . . . . 20-29 Choosing navigator buttons to display . . . . . . . . . . . . . . . . . . 20-30 Hiding and showing navigator buttons at design time . . . . . . . . . 20-30 Hiding and showing navigator buttons at runtime . . . . . . . . . . . 20-31 Displaying fly-over help. . . . . . . . . . . 20-31 Using a single navigator for multiple datasets . . . . . . . . . . . . . . . . . . . 20-32 Chapter 21 Creating reports with Rave Reports 21-1 Overview . . . . . . . . . . . . . . . . . . . . . .21-1 Getting started . . . . . . . . . . . . . . . . . . .21-2 The Rave Visual Designer. . . . . . . . . . . . .21-3 Component overview . . . . . . . . . . . . . . .21-4 VCL/CLX components . . . . . . . . . . . .21-4 Engine components. . . . . . . . . . . . .21-4 Render components . . . . . . . . . . . .21-4 Data connection components . . . . . . .21-4 Rave project component . . . . . . . . . .21-5 Reporting components. . . . . . . . . . . . .21-5 Project components. . . . . . . . . . . . .21-5 Data objects . . . . . . . . . . . . . . . . .21-5 Standard components . . . . . . . . . . .21-5 Drawing components . . . . . . . . . . .21-5 Report components. . . . . . . . . . . . .21-6 Bar code components. . . . . . . . . . . .21-6 Getting more information. . . . . . . . . . . . .21-6 Chapter 22 Using decision support components 22-1 Overview . . . . . . . . . . . . . . . . . . . . . 22-1 About crosstabs . . . . . . . . . . . . . . . . . . 22-2 One-dimensional crosstabs. . . . . . . . . . 22-3 Multidimensional crosstabs . . . . . . . . . 22-3 Guidelines for using decision support components . . . . . . . . . . . . . . . . . . . 22-4 Using datasets with decision support components . . . . . . . . . . . . . . . . . . . 22-5 Creating decision datasets with TQuery or TTable . . . . . . . . . . . . . . . . . . . 22-6 Creating decision datasets with the Decision Query editor. . . . . . . . . . . . 22-6 Using decision cubes . . . . . . . . . . . . . . . 22-7 Decision cube properties and events . . . . 22-7 Using the Decision Cube editor . . . . . . . 22-8 Viewing and changing dimension settings . . . . . . . . . . . . . . . . . . 22-8 Setting the maximum available dimensions and summaries. . . . . . . 22-9 Viewing and changing design options . . . . . . . . . . . . . . . . . . 22-9 Using decision sources . . . . . . . . . . . . . . 22-9 Properties and events . . . . . . . . . . . . . 22-9 Using decision pivots. . . . . . . . . . . . . . 22-10 Decision pivot properties. . . . . . . . . . 22-10 Creating and using decision grids . . . . . . .22-11 Creating decision grids . . . . . . . . . . . .22-11 Using decision grids . . . . . . . . . . . . .22-11 Opening and closing decision grid fields. . . . . . . . . . . . . . . . . . . .22-11 Reorganizing rows and columns in decision grids. . . . . . . . . . . . . . 22-12 Drilling down for detail in decision grids . . . . . . . . . . . . . . . . . . . 22-12 Limiting dimension selection in decision grids. . . . . . . . . . . . . . 22-12 Decision grid properties . . . . . . . . . . 22-12 Creating and using decision graphs . . . . . 22-13 Creating decision graphs . . . . . . . . . . 22-13 Using decision graphs . . . . . . . . . . . 22-14 The decision graph display. . . . . . . . . 22-15 Customizing decision graphs . . . . . . . 22-16 Setting decision graph template defaults . . . . . . . . . . . . . . . . . 22-17 Customizing decision graph series . . 22-18
  • 17. xiii Decision support components at runtime . . . . . . . . . . . . . . . . . . . . . 22-19 Decision pivots at runtime . . . . . . . . . 22-19 Decision grids at runtime . . . . . . . . . . 22-19 Decision graphs at runtime . . . . . . . . . 22-20 Decision support components and memory control . . . . . . . . . . . . . . . . . . . . . . 22-20 Setting maximum dimensions, summaries, and cells . . . . . . . . . . . . 22-20 Setting dimension state . . . . . . . . . . . 22-21 Using paged dimensions . . . . . . . . . . 22-21 Chapter 23 Connecting to databases 23-1 Using implicit connections . . . . . . . . . . . .23-2 Controlling connections. . . . . . . . . . . . . .23-3 Connecting to a database server . . . . . . .23-3 Disconnecting from a database server . . . .23-4 Controlling server login. . . . . . . . . . . . . .23-4 Managing transactions . . . . . . . . . . . . . .23-6 Starting a transaction . . . . . . . . . . . . .23-7 Ending a transaction . . . . . . . . . . . . . .23-8 Ending a successful transaction . . . . . .23-8 Ending an unsuccessful transaction . . .23-9 Specifying the transaction isolation level . . . . . . . . . . . . . . . . . . . . . .23-9 Sending commands to the server . . . . . . . 23-10 Working with associated datasets . . . . . . . 23-12 Closing all datasets without disconnecting from the server. . . . . . . 23-12 Iterating through the associated datasets . . . . . . . . . . . . . . . . . . . 23-13 Obtaining metadata . . . . . . . . . . . . . . . 23-13 Listing available tables. . . . . . . . . . . . 23-14 Listing the fields in a table . . . . . . . . . 23-14 Listing available stored procedures . . . . 23-14 Listing available indexes . . . . . . . . . . 23-14 Listing stored procedure parameters. . . . 23-15 Chapter 24 Understanding datasets 24-1 Using TDataSet descendants . . . . . . . . . . .24-2 Determining dataset states . . . . . . . . . . . .24-3 Opening and closing datasets . . . . . . . . . .24-4 Navigating datasets . . . . . . . . . . . . . . . .24-5 Using the First and Last methods . . . . . .24-6 Using the Next and Prior methods . . . . . .24-7 Using the MoveBy method . . . . . . . . . .24-7 Using the Eof and Bof properties . . . . . . 24-8 Eof . . . . . . . . . . . . . . . . . . . . . . 24-8 Bof . . . . . . . . . . . . . . . . . . . . . . 24-9 Marking and returning to records . . . . . . 24-9 The Bookmark property. . . . . . . . . . 24-9 The GetBookmark method . . . . . . . 24-10 The GotoBookmark and BookmarkValid methods . . . . . . . 24-10 The CompareBookmarks method . . . 24-10 The FreeBookmark method. . . . . . . 24-10 A bookmarking example . . . . . . . . 24-10 Searching datasets . . . . . . . . . . . . . . . .24-11 Using Locate . . . . . . . . . . . . . . . . . .24-11 Using Lookup . . . . . . . . . . . . . . . . 24-12 Displaying and editing a subset of data using filters . . . . . . . . . . . . . . . . . . 24-13 Enabling and disabling filtering . . . . . . 24-13 Creating filters . . . . . . . . . . . . . . . . 24-13 Setting the Filter property. . . . . . . . 24-14 Writing an OnFilterRecord event handler . . . . . . . . . . . . . . . . . 24-15 Switching filter event handlers at runtime . . . . . . . . . . . . . . . . . 24-16 Setting filter options. . . . . . . . . . . . . 24-16 Navigating records in a filtered dataset . . . . . . . . . . . . . . . . . . . 24-16 Modifying data . . . . . . . . . . . . . . . . . 24-17 Editing records. . . . . . . . . . . . . . . . 24-18 Adding new records . . . . . . . . . . . . 24-19 Inserting records . . . . . . . . . . . . . 24-19 Appending records . . . . . . . . . . . 24-20 Deleting records . . . . . . . . . . . . . . . 24-20 Posting data . . . . . . . . . . . . . . . . . 24-21 Canceling changes. . . . . . . . . . . . . . 24-21 Modifying entire records . . . . . . . . . . 24-22 Calculating fields . . . . . . . . . . . . . . . . 24-23 Types of datasets . . . . . . . . . . . . . . . . 24-24 Using table type datasets. . . . . . . . . . . . 24-25 Advantages of using table type datasets . . . . . . . . . . . . . . . . . . . 24-26 Sorting records with indexes. . . . . . . . 24-26 Obtaining information about indexes . . . . . . . . . . . . . . . . . 24-27 Specifying an index with IndexName . . . . . . . . . . . . . . . 24-27 Creating an index with IndexFieldNames . . . . . . . . . . . 24-28
  • 18. xiv Using Indexes to search for records . . . . 24-28 Executing a search with Goto methods . . . . . . . . . . . . . . . . . 24-29 Executing a search with Find methods . . . . . . . . . . . . . . . . . 24-30 Specifying the current record after a successful search . . . . . . . . . . . . 24-30 Searching on partial keys . . . . . . . . 24-30 Repeating or extending a search . . . . 24-30 Limiting records with ranges . . . . . . . . 24-31 Understanding the differences between ranges and filters . . . . . . . 24-31 Specifying ranges . . . . . . . . . . . . . 24-31 Modifying a range . . . . . . . . . . . . 24-34 Applying or canceling a range . . . . . 24-34 Creating master/detail relationships. . . . 24-35 Making the table a detail of another dataset . . . . . . . . . . . . . . . . . . 24-35 Using nested detail tables . . . . . . . . 24-37 Controlling Read/write access to tables . . . . . . . . . . . . . . . . . . . . . 24-38 Creating and deleting tables . . . . . . . . 24-38 Creating tables . . . . . . . . . . . . . . 24-38 Deleting tables . . . . . . . . . . . . . . 24-41 Emptying tables . . . . . . . . . . . . . . . 24-41 Synchronizing tables . . . . . . . . . . . . . 24-42 Using query-type datasets . . . . . . . . . . . 24-42 Specifying the query . . . . . . . . . . . . . 24-43 Specifying a query using the SQL property . . . . . . . . . . . . . . 24-44 Specifying a query using the CommandText property . . . . . . . . 24-44 Using parameters in queries . . . . . . . . 24-45 Supplying parameters at design time . . . . . . . . . . . . . . . . . . . . 24-45 Supplying parameters at runtime. . . . 24-47 Establishing master/detail relationships using parameters . . . . . . . . . . . . . . 24-47 Preparing queries. . . . . . . . . . . . . . . 24-48 Executing queries that don’t return a result set . 24-49 Using unidirectional result sets . . . . . . . 24-49 Using stored procedure-type datasets . . . . . 24-50 Working with stored procedure parameters. . . . . . . . . . . . . . . . . . 24-51 Setting up parameters at design time . . . . . . . . . . . . . . . . . . . . 24-52 Using parameters at runtime . . . . . . 24-54 Preparing stored procedures . . . . . . . . 24-55 Executing stored procedures that don’t return a result set . . . . . . . . . . . . . 24-55 Fetching multiple result sets . . . . . . . . 24-56 Chapter 25 Working with field components 25-1 Dynamic field components . . . . . . . . . . . 25-2 Persistent field components . . . . . . . . . . . 25-3 Creating persistent fields . . . . . . . . . . . 25-4 Arranging persistent fields. . . . . . . . . . 25-5 Defining new persistent fields . . . . . . . . 25-5 Defining a data field. . . . . . . . . . . . 25-6 Defining a calculated field . . . . . . . . 25-7 Programming a calculated field . . . . . 25-8 Defining a lookup field . . . . . . . . . . 25-9 Defining an aggregate field. . . . . . . 25-10 Deleting persistent field components . . . .25-11 Setting persistent field properties and events . . . . . . . . . . . . . . . . . .25-11 Setting display and edit properties at design time. . . . . . . . . . . . . . .25-11 Setting field component properties at runtime. . . . . . . . . . . . . . . . 25-13 Creating attribute sets for field components. . . . . . . . . . . . . . . 25-13 Associating attribute sets with field components. . . . . . . . . . . . . . . 25-14 Removing attribute associations . . . . 25-14 Controlling and masking user input. . . . . . . . . . . . . . . . . . . 25-15 Using default formatting for numeric, date, and time fields . . . . . . . . . . 25-15 Handling events . . . . . . . . . . . . . 25-16 Working with field component methods at runtime . . . . . . . . . . . . . . . . . . . 25-17 Displaying, converting, and accessing field values. . . . . . . . . . . . . . . . . . . 25-18 Displaying field component values in standard controls . . . . . . . . . . . . . 25-18 Converting field values. . . . . . . . . . . 25-19 Accessing field values with the default dataset property . . . . . . . . . . . . . . 25-20 Accessing field values with a dataset’s Fields property. . . . . . . . . . . . . . . 25-21 Accessing field values with a dataset’s FieldByName method. . . . . . . . . . . 25-21 Setting a default value for a field . . . . . . . 25-22
  • 19. xv Working with constraints . . . . . . . . . . . . 25-22 Creating a custom constraint . . . . . . . . 25-22 Using server constraints . . . . . . . . . . . 25-23 Using object fields . . . . . . . . . . . . . . . . 25-23 Displaying ADT and array fields . . . . . . 25-24 Working with ADT fields . . . . . . . . . . 25-25 Using persistent field components . . . 25-25 Using the dataset’s FieldByName method . . . . . . . . . . . . . . . . . . 25-25 Using the dateset’s FieldValues property . . . . . . . . . . . . . . . . . 25-25 Using the ADT field’s FieldValues property . . . . . . . . . . . . . . . . . 25-26 Using the ADT field’s Fields property . . . . . . . . . . . . . . . . . 25-26 Working with array fields . . . . . . . . . . 25-26 Using persistent fields . . . . . . . . . . 25-26 Using the array field’s FieldValues property . . . . . . . . . . . . . . . . . 25-27 Using the array field’s Fields property . . . . . . . . . . . . . . . . . 25-27 Working with dataset fields . . . . . . . . . 25-27 Displaying dataset fields. . . . . . . . . 25-27 Accessing data in a nested dataset . . . 25-28 Working with reference fields. . . . . . . . 25-28 Displaying reference fields . . . . . . . 25-28 Accessing data in a reference field . . . 25-29 Chapter 26 Using the Borland Database Engine 26-1 BDE-based architecture . . . . . . . . . . . . . .26-1 Using BDE-enabled datasets . . . . . . . . .26-2 Associating a dataset with database and session connections . . . . . . . . .26-3 Caching BLOBs . . . . . . . . . . . . . . .26-4 Obtaining a BDE handle . . . . . . . . . .26-4 Using TTable . . . . . . . . . . . . . . . . . .26-5 Specifying the table type for local tables . . . . . . . . . . . . . . . . . . . .26-5 Controlling read/write access to local tables . . . . . . . . . . . . . . . . .26-6 Specifying a dBASE index file. . . . . . .26-6 Renaming local tables . . . . . . . . . . .26-8 Importing data from another table . . . .26-8 Using TQuery. . . . . . . . . . . . . . . . . .26-9 Creating heterogeneous queries. . . . . .26-9 Obtaining an editable result set . . . . . 26-10 Updating read-only result sets . . . . . 26-11 Using TStoredProc . . . . . . . . . . . . . .26-11 Binding parameters . . . . . . . . . . . 26-12 Working with Oracle overloaded stored procedures . . . . . . . . . . . 26-12 Connecting to databases with TDatabase . . . . . . . . . . . . . . . . . 26-12 Associating a database component with a session. . . . . . . . . . . . . . 26-13 Understanding database and session component interactions . . . . . . . . 26-13 Identifying the database . . . . . . . . 26-14 Opening a connection using TDatabase. . . . . . . . . . . . . . . . 26-15 Using database components in data modules . . . . . . . . . . . . . . 26-16 Managing database sessions . . . . . . . . 26-16 Activating a session . . . . . . . . . . . 26-18 Specifying default database connection behavior . . . . . . . . . . 26-18 Managing database connections . . . . 26-19 Working with password-protected Paradox and dBASE tables . . . . . . 26-21 Specifying Paradox directory locations. . . . . . . . . . . . . . . . . 26-24 Working with BDE aliases . . . . . . . 26-25 Retrieving information about a session. . . . . . . . . . . . . . . . . 26-27 Creating additional sessions . . . . . . 26-28 Naming a session . . . . . . . . . . . . 26-29 Managing multiple sessions . . . . . . 26-29 Using transactions with the BDE . . . . . . . 26-31 Using passthrough SQL . . . . . . . . . . 26-32 Using local transactions . . . . . . . . . . 26-32 Using the BDE to cache updates . . . . . . . 26-33 Enabling BDE-based cached updates . . . 26-34 Applying BDE-based cached updates. . . 26-35 Applying cached updates using a database. . . . . . . . . . . . . . . . 26-36 Applying cached updates with dataset component methods . . . . . 26-36 Creating an OnUpdateRecord event handler . . . . . . . . . . . . . . . . . 26-37 Handling cached update errors . . . . 26-38 Using update objects to update a dataset . . . . . . . . . . . . . . . . . . 26-40 Creating SQL statements for update components. . . . . . . . . . . . . . . 26-41 Using multiple update objects . . . . . 26-45 Executing the SQL statements . . . . . 26-46
  • 20. xvi Using TBatchMove. . . . . . . . . . . . . . . . 26-49 Creating a batch move component . . . . . 26-49 Specifying a batch move mode . . . . . . . 26-50 Appending records . . . . . . . . . . . . 26-50 Updating records . . . . . . . . . . . . . 26-50 Appending and updating records . . . 26-51 Copying datasets . . . . . . . . . . . . . 26-51 Deleting records. . . . . . . . . . . . . . 26-51 Mapping data types . . . . . . . . . . . . . 26-51 Executing a batch move . . . . . . . . . . . 26-52 Handling batch move errors . . . . . . . . 26-52 The Data Dictionary . . . . . . . . . . . . . . . 26-53 Tools for working with the BDE . . . . . . . . 26-55 Chapter 27 Working with ADO components 27-1 Overview of ADO components . . . . . . . . .27-2 Connecting to ADO data stores . . . . . . . . .27-3 Connecting to a data store using TADOConnection. . . . . . . . . . . . . . .27-3 Accessing the connection object. . . . . .27-5 Fine-tuning a connection . . . . . . . . . . .27-5 Forcing asynchronous connections . . . .27-5 Controlling time-outs. . . . . . . . . . . .27-6 Indicating the types of operations the connection supports . . . . . . . . .27-6 Specifying whether the connection automatically initiates transactions . . .27-7 Accessing the connection’s commands . . .27-7 ADO connection events . . . . . . . . . . . .27-8 Events when establishing a connection . . . . . . . . . . . . . . . . .27-8 Events when disconnecting . . . . . . . .27-8 Events when managing transactions . . .27-9 Other events . . . . . . . . . . . . . . . . .27-9 Using ADO datasets . . . . . . . . . . . . . . . .27-9 Connecting an ADO dataset to a data store . . . . . . . . . . . . . . . . 27-10 Working with record sets . . . . . . . . 27-11 Filtering records based on bookmarks . . . . . . . . . . . . . . . . 27-11 Fetching records asynchronously . . . . 27-12 Using batch updates . . . . . . . . . . . 27-13 Loading data from and saving data to files. . . . . . . . . . . . . . . . 27-15 Using TADODataSet . . . . . . . . . . . . . 27-16 Using Command objects . . . . . . . . . . . . 27-18 Specifying the command . . . . . . . . . . 27-18 Using the Execute method . . . . . . . . . 27-19 Canceling commands . . . . . . . . . . . . 27-19 Retrieving result sets with commands . . 27-20 Handling command parameters. . . . . . 27-20 Chapter 28 Using unidirectional datasets 28-1 Types of unidirectional datasets. . . . . . . . . 28-2 Connecting to the database server . . . . . . . 28-2 Setting up TSQLConnection . . . . . . . . . 28-3 Identifying the driver . . . . . . . . . . . 28-3 Specifying connection parameters . . . . 28-4 Naming a connection description . . . . 28-4 Using the Connection Editor . . . . . . . 28-5 Specifying what data to display. . . . . . . . . 28-6 Representing the results of a query . . . . . 28-6 Representing the records in a table . . . . . 28-7 Representing a table using TSQLDataSet . . . . . . . . . . . . . . . 28-7 Representing a table using TSQLTable . . . . . . . . . . . . . . . . 28-7 Representing the results of a stored procedure. . . . . . . . . . . . . . . . . . . 28-8 Fetching the data . . . . . . . . . . . . . . . . . 28-8 Preparing the dataset . . . . . . . . . . . . . 28-9 Fetching multiple datasets . . . . . . . . . . 28-9 Executing commands that do not return records . . . . . . . . . . . . . . . . . 28-10 Specifying the command to execute. . . . 28-10 Executing the command . . . . . . . . . . .28-11 Creating and modifying server metadata . . . . . . . . . . . . . . . . . . .28-11 Setting up master/detail linked cursors . . . 28-12 Accessing schema information . . . . . . . . 28-13 Fetching metadata into a unidirectional dataset . . . . . . . . . . 28-13 Fetching data after using the dataset for metadata . . . . . . . . . . 28-14 The structure of metadata datasets . . . . . . . . . . . . . . . . . 28-14 Debugging dbExpress applications . . . . . . 28-19 Using TSQLMonitor to monitor SQL commands . . . . . . . . . . . . . . 28-19 Using a callback to monitor SQL commands . . . . . . . . . . . . . . 28-20
  • 21. xvii Chapter 29 Using client datasets 29-1 Working with data using a client dataset . . . .29-2 Navigating data in client datasets . . . . . .29-2 Limiting what records appear. . . . . . . . .29-2 Editing data . . . . . . . . . . . . . . . . . . .29-5 Undoing changes . . . . . . . . . . . . . .29-5 Saving changes . . . . . . . . . . . . . . .29-6 Constraining data values . . . . . . . . . . .29-7 Specifying custom constraints. . . . . . .29-7 Sorting and indexing. . . . . . . . . . . . . .29-8 Adding a new index . . . . . . . . . . . .29-8 Deleting and switching indexes. . . . . .29-9 Using indexes to group data. . . . . . . .29-9 Representing calculated values . . . . . . . 29-10 Using internally calculated fields in client datasets. . . . . . . . . . . . . 29-11 Using maintained aggregates . . . . . . . . 29-11 Specifying aggregates . . . . . . . . . . 29-12 Aggregating over groups of records. . . . . . . . . . . . . . . . . 29-13 Obtaining aggregate values . . . . . . . 29-14 Copying data from another dataset . . . . 29-14 Assigning data directly. . . . . . . . . . 29-14 Cloning a client dataset cursor . . . . . 29-15 Adding application-specific information to the data . . . . . . . . . . . . . . . . . . 29-15 Using a client dataset to cache updates . . . . 29-16 Overview of using cached updates. . . . . 29-17 Choosing the type of dataset for caching updates. . . . . . . . . . . . . . . 29-18 Indicating what records are modified . . . 29-19 Updating records . . . . . . . . . . . . . . . 29-20 Applying updates. . . . . . . . . . . . . 29-20 Intervening as updates are applied . . . 29-21 Reconciling update errors . . . . . . . . 29-23 Using a client dataset with a provider. . . . . 29-24 Specifying a provider . . . . . . . . . . . . 29-25 Requesting data from the source dataset or document . . . . . . . . . . . . 29-26 Incremental fetching . . . . . . . . . . . 29-26 Fetch-on-demand . . . . . . . . . . . . . 29-27 Getting parameters from the source dataset . . . . . . . . . . . . . . . . . . . . 29-27 Passing parameters to the source dataset . . . . . . . . . . . . . . . . . . . . 29-28 Sending query or stored procedure parameters . . . . . . . . . . . . . . . . 29-29 Limiting records with parameters . . . 29-29 Handling constraints from the server . . . 29-30 Refreshing records. . . . . . . . . . . . . . 29-31 Communicating with providers using custom events . . . . . . . . . . . . . . . 29-31 Overriding the source dataset . . . . . . . 29-32 Using a client dataset with file-based data . . . . . . . . . . . . . . . . . . . . . . . 29-33 Creating a new dataset . . . . . . . . . . . 29-33 Loading data from a file or stream . . . . 29-34 Merging changes into data . . . . . . . . . 29-34 Saving data to a file or stream . . . . . . . 29-35 Using a simple dataset . . . . . . . . . . . . . 29-35 When to use TSimpleDataSet . . . . . . . 29-36 Setting up a simple dataset. . . . . . . . . 29-36 Chapter 30 Using provider components 30-1 Determining the source of data . . . . . . . . . 30-2 Using a dataset as the source of the data . . . . . . . . . . . . . . . . . . . . 30-2 Using an XML document as the source of the data . . . . . . . . . . . . . . . . . . 30-2 Communicating with the client dataset . . . . 30-3 Choosing how to apply updates using a dataset provider . . . . . . . . . . . . . . . . 30-4 Controlling what information is included in data packets. . . . . . . . . . . . . . . . . . 30-4 Specifying what fields appear in data packets . . . . . . . . . . . . . . . . . . . . 30-4 Setting options that influence the data packets . . . . . . . . . . . . . . . . . . . . 30-5 Adding custom information to data packets . . . . . . . . . . . . . . . . . . . . 30-6 Responding to client data requests . . . . . . . 30-7 Responding to client update requests . . . . . 30-8 Editing delta packets before updating the database . . . . . . . . . . . . . . . . . 30-9 Influencing how updates are applied . . . 30-10 Screening individual updates . . . . . . . .30-11 Resolving update errors on the provider. . . . . . . . . . . . . . . . . . . .30-11 Applying updates to datasets that do not represent a single table . . . . . . 30-12 Responding to client-generated events. . . . 30-12 Handling server constraints . . . . . . . . . . 30-13
  • 22. xviii Chapter 31 Creating multi-tiered applications 31-1 Advantages of the multi-tiered database model . . . . . . . . . . . . . . . . . . . . . . .31-2 Understanding multi-tiered database applications . . . . . . . . . . . . . . . . . . . .31-2 Overview of a three-tiered application. . . .31-3 The structure of the client application . . . .31-4 The structure of the application server. . . .31-5 The contents of the remote data module . . . . . . . . . . . . . . . .31-6 Using transactional data modules . . . .31-7 Pooling remote data modules . . . . . . .31-8 Choosing a connection protocol . . . . . . .31-9 Using DCOM connections . . . . . . . . .31-9 Using Socket connections . . . . . . . . .31-9 Using Web connections. . . . . . . . . . 31-10 Using SOAP connections. . . . . . . . . 31-11 Building a multi-tiered application . . . . . . 31-11 Creating the application server. . . . . . . . . 31-12 Setting up the remote data module. . . . . 31-13 Configuring TRemoteDataModule . . . 31-13 Configuring TMTSDataModule. . . . . 31-15 Configuring TSoapDataModule. . . . . 31-16 Extending the application server’s interface . . . . . . . . . . . . . . . . . . . 31-16 Adding callbacks to the application server’s interface . . . . . . . . . . . . 31-17 Extending a transactional application server’s interface . . . . . . . . . . . . 31-17 Managing transactions in multi-tiered applications . . . . . . . . . . . . . . . . . 31-17 Supporting master/detail relationships. . . . . . . . . . . . . . . . . 31-18 Supporting state information in remote data modules . . . . . . . . . . . . . . . . 31-19 Using multiple remote data modules . . . 31-21 Registering the application server . . . . . . . 31-22 Creating the client application . . . . . . . . . 31-22 Connecting to the application server. . . . 31-23 Specifying a connection using DCOM . . . . . . . . . . . . . . . . . . 31-24 Specifying a connection using sockets . . . . . . . . . . . . . . . . . . 31-24 Specifying a connection using HTTP . . . . . . . . . . . . . . . . . . . 31-25 Specifying a connection using SOAP . . . . . . . . . . . . . . . . . . . 31-26 Brokering connections . . . . . . . . . . 31-27 Managing server connections . . . . . . . 31-27 Connecting to the server . . . . . . . . 31-27 Dropping or changing a server connection . . . . . . . . . . . . . . . 31-28 Calling server interfaces . . . . . . . . . . 31-28 Using early binding with DCOM . . . 31-29 Using dispatch interfaces with TCP/IP or HTTP . . . . . . . . . . . . 31-29 Calling the interface of a SOAP-based server . . . . . . . . . . . . . . . . . . 31-30 Connecting to an application server that uses multiple data modules . . . . . 31-30 Writing Web-based client applications . . . . 31-31 Distributing a client application as an ActiveX control . . . . . . . . . . . . . . 31-32 Creating an Active Form for the client application. . . . . . . . . . . . 31-33 Building Web applications using InternetExpress . . . . . . . . . . . . . . 31-33 Building an InternetExpress application . . . . . . . . . . . . . . . . . 31-34 Using the javascript libraries . . . . . . 31-35 Granting permission to access and launch the application server . . . . . 31-36 Using an XML broker . . . . . . . . . . . . 31-36 Fetching XML data packets. . . . . . . 31-36 Applying updates from XML delta packets . . . . . . . . . . . . . . . . . 31-37 Creating Web pages with an InternetExpress page producer . . . . . 31-39 Using the Web page editor . . . . . . . 31-39 Setting Web item properties . . . . . . 31-40 Customizing the InternetExpress page producer template . . . . . . . . 31-41 Chapter 32 Using XML in database applications 32-1 Defining transformations . . . . . . . . . . . . 32-1 Mapping between XML nodes and data packet fields . . . . . . . . . . . . . . 32-2 Using XMLMapper . . . . . . . . . . . . . . 32-4 Loading an XML schema or data packet . . . . . . . . . . . . . . . . . . . 32-4 Defining mappings . . . . . . . . . . . . 32-5 Generating transformation files . . . . . 32-6
  • 23. xix Converting XML documents into data packets . . . . . . . . . . . . . . . . . . . . . .32-6 Specifying the source XML document . . . .32-6 Specifying the transformation . . . . . . . .32-7 Obtaining the resulting data packet . . . . .32-7 Converting user-defined nodes. . . . . . . .32-7 Using an XML document as the source for a provider . . . . . . . . . . . . . . . . . . .32-8 Using an XML document as the client of a provider . . . . . . . . . . . . . . . . . . . . .32-9 Fetching an XML document from a provider . . . . . . . . . . . . . . . . . . .32-9 Applying updates from an XML document to a provider . . . . . . . . . . 32-11 Part III Writing Internet applications Chapter 33 Creating Internet server applications 33-1 About Web Broker and WebSnap . . . . . . . .33-1 Terminology and standards. . . . . . . . . . . .33-3 Parts of a Uniform Resource Locator. . . . .33-3 URI vs. URL . . . . . . . . . . . . . . . . .33-4 HTTP request header information . . . . . .33-4 HTTP server activity. . . . . . . . . . . . . . . .33-5 Composing client requests . . . . . . . . . .33-5 Serving client requests . . . . . . . . . . . . .33-5 Responding to client requests. . . . . . . . .33-6 Types of Web server applications . . . . . . . .33-6 ISAPI and NSAPI . . . . . . . . . . . . . .33-6 CGI stand-alone. . . . . . . . . . . . . . .33-6 Apache . . . . . . . . . . . . . . . . . . . .33-7 Web App Debugger. . . . . . . . . . . . .33-7 Converting Web server application target types . . . . . . . . . . . . . . . . . .33-8 Debugging server applications . . . . . . . . . .33-9 Using the Web Application Debugger . . . .33-9 Launching your application with the Web Application Debugger . . . . . . .33-9 Converting your application to another type of Web server application . . . . 33-10 Debugging Web applications that are DLLs . . . . . . . . . . . . . . . . . . . 33-10 User rights necessary for DLL debugging . . . . . . . . . . . . . . . . 33-10 Chapter 34 Using Web Broker 34-1 Creating Web server applications with Web Broker. . . . . . . . . . . . . . . . . . . . 34-1 The Web module. . . . . . . . . . . . . . . . 34-2 The Web Application object . . . . . . . . . 34-3 The structure of a Web Broker application . . . 34-3 The Web dispatcher. . . . . . . . . . . . . . . . 34-5 Adding actions to the dispatcher . . . . . . 34-5 Dispatching request messages . . . . . . . . 34-5 Action items . . . . . . . . . . . . . . . . . . . . 34-6 Determining when action items fire. . . . . 34-6 The target URL. . . . . . . . . . . . . . . 34-6 The request method type . . . . . . . . . 34-7 Enabling and disabling action items. . . 34-7 Choosing a default action item. . . . . . 34-7 Responding to request messages with action items. . . . . . . . . . . . . . . . . . 34-8 Sending the response . . . . . . . . . . . 34-8 Using multiple action items . . . . . . . 34-9 Accessing client request information . . . . . . 34-9 Properties that contain request header information. . . . . . . . . . . . . . . . . . 34-9 Properties that identify the target . . . . 34-9 Properties that describe the Web client. . . . . . . . . . . . . . . . . . . 34-10 Properties that identify the purpose of the request . . . . . . . . . . . . . . 34-10 Properties that describe the expected response. . . . . . . . . . . . . . . . . 34-10 Properties that describe the content . . .34-11 The content of HTTP request messages. . .34-11 Creating HTTP response messages . . . . . . .34-11 Filling in the response header . . . . . . . .34-11 Indicating the response status . . . . . 34-12 Indicating the need for client action . . 34-12 Describing the server application . . . 34-12 Describing the content . . . . . . . . . 34-12 Setting the response content . . . . . . . . 34-13 Sending the response . . . . . . . . . . . . 34-13 Generating the content of response messages . . . . . . . . . . . . . . . . . . . . 34-13 Using page producer components. . . . . 34-14 HTML templates. . . . . . . . . . . . . 34-14 Specifying the HTML template. . . . . 34-15 Converting HTML-transparent tags . . . . . . . . . . . . . . . . . . . 34-16
  • 24. xx Using page producers from an action item . . . . . . . . . . . . . . . . 34-16 Chaining page producers together . . . 34-17 Using database information in responses . . . 34-18 Adding a session to the Web module . . . 34-18 Representing database information in HTML. . . . . . . . . . . . . . . . . . . 34-19 Using dataset page producers . . . . . . 34-19 Using table producers . . . . . . . . . . 34-20 Specifying the table attributes. . . . . . 34-20 Specifying the row attributes . . . . . . 34-20 Specifying the columns. . . . . . . . . . 34-20 Embedding tables in HTML documents . . . . . . . . . . . . . . . . 34-21 Setting up a dataset table producer . . . 34-21 Setting up a query table producer . . . 34-21 Chapter 35 Creating Web Server applications using WebSnap 35-1 Fundamental WebSnap components. . . . . . .35-2 Web modules . . . . . . . . . . . . . . . . . .35-2 Web application module types . . . . . .35-3 Web page modules . . . . . . . . . . . . .35-4 Web data modules . . . . . . . . . . . . .35-5 Adapters. . . . . . . . . . . . . . . . . . . . .35-5 Fields . . . . . . . . . . . . . . . . . . . . .35-6 Actions . . . . . . . . . . . . . . . . . . . .35-6 Errors. . . . . . . . . . . . . . . . . . . . .35-6 Records. . . . . . . . . . . . . . . . . . . .35-6 Page producers . . . . . . . . . . . . . . . . .35-6 Creating Web server applications with WebSnap . . . . . . . . . . . . . . . . . . . . .35-7 Selecting a server type . . . . . . . . . . . . .35-8 Specifying application module components . . . . . . . . . . . . . . . . . .35-9 Selecting Web application module options . . . . . . . . . . . . . . . . . . . . 35-10 Advanced HTML design . . . . . . . . . . . . 35-11 Manipulating server-side script in HTML files . . . . . . . . . . . . . . . . . 35-12 Login support . . . . . . . . . . . . . . . . . . 35-13 Adding login support . . . . . . . . . . . . 35-13 Using the sessions service . . . . . . . . . . 35-14 Login pages . . . . . . . . . . . . . . . . . . 35-15 Setting pages to require logins . . . . . . . 35-17 User access rights . . . . . . . . . . . . . . 35-17 Dynamically displaying fields as edit or text boxes . . . . . . . . . . . . . . 35-18 Hiding fields and their contents . . . . 35-18 Preventing page access . . . . . . . . . 35-19 Server-side scripting in WebSnap . . . . . . . 35-19 Active scripting . . . . . . . . . . . . . . . 35-20 Script engine . . . . . . . . . . . . . . . . . 35-20 Script blocks . . . . . . . . . . . . . . . . . 35-20 Creating script . . . . . . . . . . . . . . . . 35-21 Wizard templates . . . . . . . . . . . . 35-21 TAdapterPageProducer . . . . . . . . . 35-21 Editing and viewing script . . . . . . . . . 35-21 Including script in a page. . . . . . . . . . 35-21 Script objects . . . . . . . . . . . . . . . . . 35-22 Dispatching requests and responses . . . . . 35-22 Dispatcher components. . . . . . . . . . . 35-23 Adapter dispatcher operation . . . . . . . 35-23 Using adapter components to generate content . . . . . . . . . . . . 35-23 Receiving adapter requests and generating responses . . . . . . . . . 35-25 Image request . . . . . . . . . . . . . . 35-26 Image response. . . . . . . . . . . . . . 35-27 Dispatching action items . . . . . . . . . . 35-27 Page dispatcher operation . . . . . . . . . 35-28 Chapter 36 Creating Web server applications using IntraWeb 36-1 Using IntraWeb components. . . . . . . . . . . 36-2 Getting started with IntraWeb. . . . . . . . . . 36-3 Creating a new IntraWeb application . . . . 36-4 Editing the main form . . . . . . . . . . . . 36-4 Writing an event handler for the button . . 36-5 Running the completed application. . . . . 36-6 Using IntraWeb with Web Broker and WebSnap . . 36-7 For more information. . . . . . . . . . . . . . . 36-8 Chapter 37 Working with XML documents 37-1 Using the Document Object Model . . . . . . . 37-2 Working with XML components . . . . . . . . 37-4 Using TXMLDocument . . . . . . . . . . . . 37-4 Working with XML nodes . . . . . . . . . . 37-4 Working with a node’s value . . . . . . . 37-5 Working with a node’s attributes . . . . 37-5 Adding and deleting child nodes . . . . 37-6
  • 25. xxi Abstracting XML documents with the Data Binding wizard. . . . . . . . . . . . . . .37-6 Using the XML Data Binding wizard . . . .37-8 Using code that the XML Data Binding wizard generates . . . . . . . . . . . . . . .37-9 Chapter 38 Using Web Services 38-1 Understanding invokable interfaces . . . . . . .38-2 Using nonscalar types in invokable interfaces . . . . . . . . . . . . . . . . . . .38-4 Registering nonscalar types . . . . . . . .38-5 Using remotable objects . . . . . . . . . .38-6 Representing attachments . . . . . . . . .38-7 Managing the lifetime of remotable objects . . . . . . . . . . . . . . . . . . .38-7 Remotable object example . . . . . . . . .38-7 Writing servers that support Web Services . . . . . . . . . . . . . . . . . . . . . .38-9 Building a Web Service server . . . . . . . .38-9 Using the SOAP application wizard . . . . 38-10 Adding new Web Services. . . . . . . . . . 38-11 Editing the generated code . . . . . . . 38-12 Using a different base class . . . . . . . 38-12 Using the Web Services Importer. . . . . . 38-13 Browsing for Business services . . . . . . . 38-14 Understanding UDDI . . . . . . . . . . 38-15 Using the UDDI browser. . . . . . . . . 38-15 Defining and using SOAP headers . . . . . 38-16 Defining header classes . . . . . . . . . 38-16 Sending and receiving headers . . . . . 38-16 Communicating the structure of your headers to other applications . . . . . 38-17 Creating custom exception classes for Web Services . . . . . . . . . . . . . . . . 38-18 Generating WSDL documents for a Web Service application . . . . . . . . . . 38-19 Writing clients for Web Services . . . . . . . . 38-20 Importing WSDL documents . . . . . . . . 38-20 Calling invokable interfaces. . . . . . . . . 38-20 Obtaining an invokable interface from the generated function . . . . . . 38-21 Using a remote interfaced object . . . . 38-21 Processing headers in client applications . 38-23 Chapter 39 Working with sockets 39-1 Implementing services . . . . . . . . . . . . . . 39-1 Understanding service protocols . . . . . . 39-2 Communicating with applications. . . . 39-2 Services and ports . . . . . . . . . . . . . . . 39-2 Types of socket connections . . . . . . . . . . . 39-3 Client connections. . . . . . . . . . . . . . . 39-3 Listening connections. . . . . . . . . . . . . 39-3 Server connections . . . . . . . . . . . . . . 39-3 Describing sockets . . . . . . . . . . . . . . . . 39-4 Describing the host . . . . . . . . . . . . . . 39-4 Choosing between a host name and an IP address . . . . . . . . . . . . . . . 39-5 Using ports. . . . . . . . . . . . . . . . . . . 39-5 Using socket components . . . . . . . . . . . . 39-6 Getting information about the connection . . . . . . . . . . . . . . . . . . 39-6 Using client sockets . . . . . . . . . . . . . . 39-6 Specifying the desired server. . . . . . . 39-7 Forming the connection . . . . . . . . . . 39-7 Getting information about the connection . . . . . . . . . . . . . . . . 39-7 Closing the connection . . . . . . . . . . 39-7 Using server sockets . . . . . . . . . . . . . 39-7 Specifying the port. . . . . . . . . . . . . 39-8 Listening for client requests . . . . . . . 39-8 Connecting to clients . . . . . . . . . . . 39-8 Closing server connections . . . . . . . . 39-8 Responding to socket events. . . . . . . . . . . 39-8 Error events . . . . . . . . . . . . . . . . . . 39-9 Client events . . . . . . . . . . . . . . . . . . 39-9 Server events. . . . . . . . . . . . . . . . . . 39-9 Events when listening . . . . . . . . . . . 39-9 Events with client connections . . . . . 39-10 Reading and writing over socket connections . . . . . . . . . . . . . . . . . . 39-10 Non-blocking connections . . . . . . . . . 39-10 Reading and writing events . . . . . . .39-11 Blocking connections . . . . . . . . . . . . .39-11
  • 26. xxii Part IV Developing COM-based applications Chapter 40 Overview of COM technologies 40-1 COM as a specification and implementation . . . . . . . . . . . . . .40-2 COM extensions . . . . . . . . . . . . . .40-2 Parts of a COM application . . . . . . . . . . . .40-3 COM interfaces . . . . . . . . . . . . . . . . .40-3 The fundamental COM interface, IUnknown . . . . . . . . . . . . . . . . .40-4 COM interface pointers . . . . . . . . . .40-5 COM servers . . . . . . . . . . . . . . . . . .40-5 CoClasses and class factories . . . . . . .40-6 In-process, out-of-process, and remote servers . . . . . . . . . . . . . . .40-7 The marshaling mechanism . . . . . . . .40-8 Aggregation . . . . . . . . . . . . . . . . .40-9 COM clients. . . . . . . . . . . . . . . . . . 40-10 COM extensions . . . . . . . . . . . . . . . . . 40-10 Automation servers . . . . . . . . . . . . . 40-12 Active Server Pages . . . . . . . . . . . . . 40-13 ActiveX controls . . . . . . . . . . . . . . . 40-13 Active Documents . . . . . . . . . . . . . . 40-14 Transactional objects . . . . . . . . . . . . . 40-15 Type libraries . . . . . . . . . . . . . . . . . 40-16 The content of type libraries. . . . . . . 40-16 Creating type libraries . . . . . . . . . . 40-17 When to use type libraries . . . . . . . . 40-17 Accessing type libraries . . . . . . . . . 40-18 Benefits of using type libraries . . . . . 40-18 Using type library tools . . . . . . . . . 40-19 Implementing COM objects with wizards . . . . . . . . . . . . . . . . . . . . . 40-19 Code generated by wizards . . . . . . . . . 40-22 Chapter 41 Working with type libraries 41-1 Type Library editor . . . . . . . . . . . . . . . .41-2 Parts of the Type Library editor. . . . . . . .41-3 Toolbar . . . . . . . . . . . . . . . . . . . .41-3 Object list pane . . . . . . . . . . . . . . .41-5 Status bar . . . . . . . . . . . . . . . . . .41-5 Pages of type information . . . . . . . . .41-6 Type library elements . . . . . . . . . . . . .41-8 Interfaces. . . . . . . . . . . . . . . . . . .41-9 Dispinterfaces . . . . . . . . . . . . . . . .41-9 CoClasses . . . . . . . . . . . . . . . . . 41-10 Type definitions . . . . . . . . . . . . . 41-10 Modules. . . . . . . . . . . . . . . . . . .41-11 Using the Type Library editor . . . . . . . .41-11 Valid types . . . . . . . . . . . . . . . . 41-12 Using Delphi or IDL syntax . . . . . . 41-13 Creating a new type library. . . . . . . 41-19 Opening an existing type library. . . . 41-20 Adding an interface to the type library . . . . . . . . . . . . . . . . . . 41-21 Modifying an interface using the type library . . . . . . . . . . . . . . . 41-21 Adding properties and methods to an interface or dispinterface . . . . . 41-22 Adding a CoClass to the type library . . . . . . . . . . . . . . . . . . 41-23 Adding an interface to a CoClass . . . 41-23 Adding an enumeration to the type library . . . . . . . . . . . . . . . 41-24 Adding an alias to the type library . . 41-24 Adding a record or union to the type library . . . . . . . . . . . . . . . 41-24 Adding a module to the type library . . . . . . . . . . . . . . . . . . 41-25 Saving and registering type library information. . . . . . . . . . . 41-25 Apply Updates dialog. . . . . . . . . . 41-26 Saving a type library . . . . . . . . . . 41-26 Refreshing the type library . . . . . . . 41-26 Registering the type library. . . . . . . 41-27 Exporting an IDL file . . . . . . . . . . 41-27 Deploying type libraries . . . . . . . . . . . . 41-27 Chapter 42 Creating COM clients 42-1 Importing type library information. . . . . . . 42-2 Using the Import Type Library dialog . . . 42-3 Using the Import ActiveX dialog . . . . . . 42-4 Code generated when you import type library information . . . . . . . . . . 42-5 Controlling an imported object . . . . . . . . . 42-6 Using component wrappers . . . . . . . . . 42-6 ActiveX wrappers . . . . . . . . . . . . . 42-6 Automation object wrappers . . . . . . . 42-7 Using data-aware ActiveX controls . . . . . 42-8 Example: Printing a document with Microsoft Word . . . . . . . . . . . . . . . 42-9 Preparing Delphi for this example. . . 42-10 Importing the Word type library . . . . 42-10
  • 27. xxiii Using a VTable or dispatch interface object to control Microsoft Word . . . 42-11 Cleaning up the example . . . . . . . . 42-12 Writing client code based on type library definitions . . . . . . . . . . . . . . . . . . 42-13 Connecting to a server . . . . . . . . . . 42-13 Controlling an Automation server using a dual interface. . . . . . . . . . 42-13 Controlling an Automation server using a dispatch interface . . . . . . . 42-14 Handling events in an automation controller. . . . . . . . . . . . . . . . . 42-14 Creating clients for servers that do not have a type library . . . . . . . . . . . . . . . 42-16 Using .NET Assemblies with Delphi . . . . . 42-17 Requirements for COM Interoperability . . . . . . . . . . . . . . . 42-17 .NET components and type libraries . . . . 42-18 Accessing user-defined .NET components . . . . . . . . . . . . . . . . . 42-20 Chapter 43 Creating simple COM servers 43-1 Overview of creating a COM object . . . . . . .43-2 Designing a COM object . . . . . . . . . . . . .43-2 Using the COM object wizard . . . . . . . . . .43-3 Using the Automation object wizard . . . . . .43-5 COM object instancing types . . . . . . . . .43-6 Choosing a threading model . . . . . . . . .43-6 Writing an object that supports the free threading model . . . . . . . . . . .43-8 Writing an object that supports the apartment threading model . . . . . . .43-9 Writing an object that supports the neutral threading model . . . . . . . . .43-9 Defining a COM object’s interface . . . . . . . .43-9 Adding a property to the object’s interface . . . . . . . . . . . . . . . . . . . 43-10 Adding a method to the object’s interface . . . . . . . . . . . . . . . . . . . 43-10 Exposing events to clients . . . . . . . . . . 43-11 Managing events in your Automation object . . . . . . . . . . . 43-12 Automation interfaces. . . . . . . . . . . . . . 43-13 Dual interfaces . . . . . . . . . . . . . . . . 43-13 Dispatch interfaces . . . . . . . . . . . . . . 43-14 Custom interfaces . . . . . . . . . . . . . . 43-15 Marshaling data. . . . . . . . . . . . . . . . . 43-15 Automation compatible types . . . . . . . 43-16 Type restrictions for automatic marshaling . . . . . . . . . . . . . . . . . 43-16 Custom marshaling . . . . . . . . . . . . . 43-17 Registering a COM object . . . . . . . . . . . 43-17 Registering an in-process server . . . . . . 43-17 Registering an out-of-process server . . . 43-17 Testing and debugging the application. . . . 43-18 Chapter 44 Creating an Active Server Page 44-1 Creating an Active Server Object . . . . . . . . 44-2 Using the ASP intrinsics . . . . . . . . . . . 44-3 Application . . . . . . . . . . . . . . . . . 44-4 Request . . . . . . . . . . . . . . . . . . . 44-4 Response . . . . . . . . . . . . . . . . . . 44-5 Session . . . . . . . . . . . . . . . . . . . 44-6 Server . . . . . . . . . . . . . . . . . . . . 44-6 Creating ASPs for in-process or out-of- process servers. . . . . . . . . . . . . . . . 44-7 Registering an Active Server Object . . . . . . 44-8 Registering an in-process server . . . . . . . 44-8 Registering an out-of-process server . . . . 44-8 Testing and debugging the Active Server Page application. . . . . . . . . . . . . . . . . 44-8 Chapter 45 Creating an ActiveX control 45-1 Overview of ActiveX control creation . . . . . 45-2 Elements of an ActiveX control . . . . . . . 45-2 VCL control. . . . . . . . . . . . . . . . . 45-3 ActiveX wrapper. . . . . . . . . . . . . . 45-3 Type library. . . . . . . . . . . . . . . . . 45-3 Property page . . . . . . . . . . . . . . . 45-3 Designing an ActiveX control . . . . . . . . . . 45-4 Generating an ActiveX control from a VCL control . . . . . . . . . . . . . . . . . . . 45-4 Generating an ActiveX control based on a VCL form. . . . . . . . . . . . . . . . . . . . 45-6 Licensing ActiveX controls. . . . . . . . . . . . 45-7 Customizing the ActiveX control’s interface . . . . . . . . . . . . . . . . . . . . . 45-8 Adding additional properties, methods, and events . . . . . . . . . . . . 45-9 Adding properties and methods . . . . . 45-9 Adding events . . . . . . . . . . . . . . 45-10 Enabling simple data binding with the type library. . . . . . . . . . . . . . . .45-11
  • 28. xxiv Creating a property page for an ActiveX control . . . . . . . . . . . . . . . . . 45-12 Creating a new property page . . . . . . . 45-13 Adding controls to a property page . . . . 45-13 Associating property page controls with ActiveX control properties. . . . . . 45-13 Updating the property page . . . . . . . 45-13 Updating the object. . . . . . . . . . . . 45-14 Connecting a property page to an ActiveX control . . . . . . . . . . . . . 45-14 Registering an ActiveX control . . . . . . . . . 45-15 Testing an ActiveX control . . . . . . . . . . . 45-15 Deploying an ActiveX control on the Web . . . . . . . . . . . . . . . . . . . . . 45-15 Setting options . . . . . . . . . . . . . . . . 45-16 Chapter 46 Creating MTS or COM+ objects 46-1 Understanding transactional objects. . . . . . .46-2 Requirements for a transactional object . . .46-3 Managing resources . . . . . . . . . . . . . . . .46-3 Accessing the object context. . . . . . . . . .46-4 Just-in-time activation . . . . . . . . . . . . .46-4 Resource pooling . . . . . . . . . . . . . . . .46-5 Database resource dispensers . . . . . . .46-6 Shared property manager . . . . . . . . .46-6 Releasing resources. . . . . . . . . . . . .46-8 Object pooling . . . . . . . . . . . . . . . . .46-8 MTS and COM+ transaction support . . . . . .46-9 Transaction attributes . . . . . . . . . . . . 46-10 Setting the transaction attribute. . . . . 46-11 Stateful and stateless objects . . . . . . . . .46-11 Influencing how transactions end . . . . . 46-12 Initiating transactions. . . . . . . . . . . . 46-12 Setting up a transaction object on the client side . . . . . . . . . . . . . . 46-13 Setting up a transaction object on the server side . . . . . . . . . . . . . 46-14 Transaction time-out . . . . . . . . . . . . 46-14 Role-based security . . . . . . . . . . . . . . . 46-15 Overview of creating transactional objects . . . . . . . . . . . . . . . . . . . . . 46-15 Using the Transactional Object wizard . . . . 46-16 Choosing a threading model for a transactional object . . . . . . . . . . . . 46-17 Activities . . . . . . . . . . . . . . . . . 46-18 Generating events under COM+ . . . . . . . 46-19 Using the Event Object wizard. . . . . . . 46-21 Using the COM+ Event Subscription object wizard . . . . . . . . . . . . . . . . 46-22 Firing events using a COM+ event object . . . . . . . . . . . . . . . . . . . . 46-23 Passing object references . . . . . . . . . . . . 46-23 Using the SafeRef method . . . . . . . 46-24 Callbacks . . . . . . . . . . . . . . . . . 46-25 Debugging and testing transactional objects . . . . . . . . . . . . . . . . . . . . . 46-25 Installing transactional objects . . . . . . . . 46-26 Administering transactional objects . . . . . 46-27 Index I-1
  • 29. xxv 1.1 Typefaces and symbols . . . . . . . . . . . 1-2 3.1 Component sublibraries . . . . . . . . . . 3-1 3.2 Important base classes . . . . . . . . . . . 3-5 5.1 Values for the Origin parameter . . . . . . 5-5 5.2 Open modes . . . . . . . . . . . . . . . . . 5-7 5.3 Share modes . . . . . . . . . . . . . . . . . 5-7 5.4 Shared modes available for each open mode . . . . . . . . . . . . . . . . . . 5-7 5.5 Attribute constants and values. . . . . . . 5-9 5.6 Classes for managing lists . . . . . . . . .5-14 5.7 String comparison routines. . . . . . . . .5-24 5.8 Case conversion routines . . . . . . . . . .5-25 5.9 String modification routines . . . . . . . .5-25 5.10 Sub-string routines . . . . . . . . . . . . .5-25 5.11 Null-terminated string comparison routines . . . . . . . . . . . . . . . . . . . .5-26 5.12 Case conversion routines for null- terminated strings . . . . . . . . . . . . . .5-26 5.13 String modification routines . . . . . . . .5-26 5.14 Sub-string routines . . . . . . . . . . . . .5-26 5.15 String copying routines . . . . . . . . . . .5-27 5.16 Compiler directives for strings. . . . . . .5-30 6.1 Component palette pages . . . . . . . . . 6-7 7.1 Properties of selected text. . . . . . . . . . 7-9 7.2 Fixed vs. variable owner-draw styles . . .7-13 8.1 Compiler directives for libraries . . . . . .8-10 8.2 Database pages on the Component palette . . . . . . . . . . . . . . . . . . . . . 8-11 8.3 Web server applications. . . . . . . . . . .8-13 8.4 Context menu options for data modules. . . . . . . . . . . . . . . . . . . .8-17 8.5 Help methods in TApplication . . . . . . .8-30 9.1 Action setup terminology. . . . . . . . . .9-18 9.2 Default values of the action manager’s PrioritySchedule property . . . . . . . . .9-25 9.3 Action classes . . . . . . . . . . . . . . . .9-30 9.4 Methods overriden by base classes of specific actions . . . . . . . . . . . . . .9-31 9.5 Sample captions and their derived names . . . . . . . . . . . . . . . . . . . . .9-34 9.6 Menu Designer context menu commands . . . . . . . . . . . . . . . . . .9-40 9.7 Setting speed buttons’ appearance. . . . .9-48 9.8 Setting tool buttons’ appearance. . . . . .9-50 9.9 Setting a cool button’s appearance. . . . .9-52 10.1 Edit control properties . . . . . . . . . . . 10-2 12.1 Graphic object types . . . . . . . . . . . . 12-3 12.2 Common properties of the Canvas object . . . . . . . . . . . . . . . . . . . . . 12-4 12.3 Common methods of the Canvas object . . . . . . . . . . . . . . . . . . . . . 12-4 12.4 CLX MIME types and constants . . . . 12-22 12.5 Mouse events . . . . . . . . . . . . . . . 12-24 12.6 Mouse-event parameters. . . . . . . . . 12-25 12.7 Multimedia device types and their functions. . . . . . . . . . . . . . . . . . 12-33 13.1 Thread priorities . . . . . . . . . . . . . . 13-3 13.2 WaitFor return values . . . . . . . . . . .13-11 14.1 Selected exception classes . . . . . . . . 14-10 15.1 Porting techniques . . . . . . . . . . . . . 15-2 15.2 Changed or different features . . . . . . . 15-7 15.3 WinCLX-only and equivalent VisualCLX units. . . . . . . . . . . . . . . 15-8 15.4 VisualCLX-only units . . . . . . . . . . . 15-9 15.5 WinCLX-only units . . . . . . . . . . . . . 15-9 15.6 Differences in the Linux and Windows operating environments . . . . . . . . . 15-18 15.7 Common Linux directories . . . . . . . 15-20 15.8 Comparable data-access components . . . . . . . . . . . . . . . . 15-23 15.9 Properties, methods, and events for cached updates . . . . . . . . . . . . 15-27 16.1 Package files. . . . . . . . . . . . . . . . . 16-2 16.2 Package-specific compiler directives . . .16-11 16.3 Package-specific command-line compiler switches. . . . . . . . . . . . . 16-13 17.1 VCL methods that support BiDi . . . . . 17-6 17.2 Estimating string lengths . . . . . . . . . 17-7 18.1 Application files . . . . . . . . . . . . . . 18-3 18.2 Merge modules and their dependencies . . . . . . . . . . . . . . . . 18-4 18.3 dbExpress deployment as stand-alone executable . . . . . . . . . . . . . . . . . . 18-7 18.4 dbExpress deployment with driver DLLs . . . . . . . . . . . . . . . . . . . . . 18-8 20.1 Data controls . . . . . . . . . . . . . . . . 20-2 20.2 Column properties . . . . . . . . . . . . 20-20 20.3 Expanded TColumn Title properties . . 20-21 20.4 Properties that affect the way composite fields appear . . . . . . . . . 20-24 Tables
  • 30. xxvi 20.5 Expanded TDBGrid Options properties. . . . . . . . . . . . . . . . . . 20-25 20.6 Grid control events . . . . . . . . . . . . 20-27 20.7 Selected database control grid properties. . . . . . . . . . . . . . . . . . 20-29 20.8 TDBNavigator buttons . . . . . . . . . . 20-30 21.1 Rave Reports documentation. . . . . . . .21-6 23.1 Database connection components . . . . .23-1 24.1 Values for the dataset State property . . .24-3 24.2 Navigational methods of datasets . . . . .24-5 24.3 Navigational properties of datasets . . . .24-6 24.4 Comparison and logical operators that can appear in a filter . . . . . . . . . 24-14 24.5 FilterOptions values. . . . . . . . . . . . 24-16 24.6 Filtered dataset navigational methods. . . . . . . . . . . . . . . . . . . 24-16 24.7 Dataset methods for inserting, updating, and deleting data . . . . . . . 24-17 24.8 Methods that work with entire records . . . . . . . . . . . . . . . . . . . 24-22 24.9 Index-based search methods . . . . . . . 24-28 25.1 TFloatField properties that affect data display . . . . . . . . . . . . . . . . .25-1 25.3 Field component properties . . . . . . . 25-11 25.4 Field component formatting routines . . . . . . . . . . . . . . . . . . . 25-15 25.5 Field component events. . . . . . . . . . 25-16 25.6 Selected field component methods . . . 25-17 25.7 Special conversion results . . . . . . . . 25-20 25.8 Types of object field components . . . . 25-24 25.9 Common object field descendant properties. . . . . . . . . . . . . . . . . . 25-24 26.1 Table types recognized by the BDE based on file extension . . . . . . . . . . .26-5 26.2 TableType values. . . . . . . . . . . . . . .26-6 26.3 BatchMove import modes . . . . . . . . .26-8 26.4 Database-related informational methods for session components . . . . 26-27 26.5 TSessionList properties and methods. . . . . . . . . . . . . . . . . . . 26-30 26.6 Properties, methods, and events for cached updates. . . . . . . . . . . . . . . 26-33 26.7 UpdateKind values . . . . . . . . . . . . 26-39 26.8 Batch move modes. . . . . . . . . . . . . 26-50 26.9 Data Dictionary interface . . . . . . . . . 26-54 27.1 ADO components . . . . . . . . . . . . . .27-2 27.2 Connection parametres . . . . . . . . . . .27-4 27.3 ADO connection modes . . . . . . . . . .27-6 27.4 Execution options for ADO datasets . . . . . . . . . . . . . . . . . . 27-12 27.5 Comparison of ADO and client dataset cached updates. . . . . . . . . . 27-13 28.1 Columns in tables of metadata listing tables . . . . . . . . . . . . . . . . . . . . 28-15 28.2 Columns in tables of metadata listing stored procedures. . . . . . . . . . . . . 28-15 28.3 Columns in tables of metadata listing fields . . . . . . . . . . . . . . . . . . . . 28-16 28.4 Columns in tables of metadata listing indexes. . . . . . . . . . . . . . . . . . . 28-17 28.5 Columns in tables of metadata listing parameters. . . . . . . . . . . . . . . . . 28-18 29.1 Filter support in client datasets . . . . . . 29-3 29.2 Summary operators for maintained aggregates . . . . . . . . . . . . . . . . . 29-12 29.3 Specialized client datasets for caching updates . . . . . . . . . . . . . . . . . . 29-18 30.1 AppServer interface members. . . . . . . 30-3 30.2 Provider options . . . . . . . . . . . . . . 30-5 30.3 UpdateStatus values . . . . . . . . . . . . 30-9 30.4 UpdateMode values . . . . . . . . . . . 30-10 30.5 ProviderFlags values . . . . . . . . . . . 30-10 31.1 Components used in multi-tiered applications . . . . . . . . . . . . . . . . . 31-3 31.2 Connection components . . . . . . . . . . 31-5 31.3 Javascript libraries . . . . . . . . . . . . 31-35 33.1 Web Broker versus WebSnap . . . . . . . 33-2 34.1 MethodType values. . . . . . . . . . . . . 34-7 35.1 Web application module types . . . . . . 35-3 35.2 Web server application types . . . . . . . 35-8 35.3 Web application components . . . . . . . 35-9 35.4 Script objects . . . . . . . . . . . . . . . 35-22 35.5 Request information found in action requests . . . . . . . . . . . . . . . . . . 35-25 36.1 VCL/CLX and IntraWeb components . . . . . . . . . . . . . . . . . 36-2 38.1 Remotable classes. . . . . . . . . . . . . . 38-6 40.1 COM object requirements . . . . . . . . 40-12 40.2 Delphi wizards for implementing COM, Automation, and ActiveX objects. . . . 40-21 40.3 DAX Base classes for generated implementation classes . . . . . . . . . 40-23 41.1 Type Library editor files . . . . . . . . . . 41-2 41.2 Type Library editor parts . . . . . . . . . 41-3 41.3 Attribute syntax. . . . . . . . . . . . . . 41-14 43.1 Threading models for COM objects . . . 43-7
  • 31. xxvii 44.1 IApplicationObject interface members . . . . . . . . . . . . . . . . . . .44-4 44.2 IRequest interface members . . . . . . . .44-4 44.3 IResponse interface members . . . . . . .44-5 44.4 ISessionObject interface members . . . . .44-6 44.5 IServer interface members . . . . . . . . .44-6 46.1 IObjectContext methods for transaction support. . . . . . . . . . . . 46-12 46.2 Threading models for transactional objects . . . . . . . . . . . . . . . . . . . 46-17 46.3 Call synchronization options . . . . . . 46-19 46.4 Event publisher return codes . . . . . . 46-23
  • 32. xxviii 3.1 A simplified hierarchy diagram . . . . . . 3-5 4.1 A simple form . . . . . . . . . . . . . . . . 4-3 9.1 A frame with data-aware controls and a data source component . . . . . . . . . .9-16 9.3 Menu terminology. . . . . . . . . . . . . .9-32 9.4 MainMenu and PopupMenu components . . . . . . . . . . . . . . . . .9-33 9.6 Adding menu items to a main menu . . .9-36 9.7 Nested menu structures. . . . . . . . . . .9-37 10.2 A progress bar . . . . . . . . . . . . . . . 10-16 11.1 Part of the ModelMaker toolbar . . . . . . 11-3 11.2 ModelMaker showing a sample model . . . . . . . . . . . . . . . . . . . . . 11-4 11.3 The Classes view. . . . . . . . . . . . . . . 11-5 11.4 The Units view . . . . . . . . . . . . . . . . 11-5 11.5 The Diagrams view . . . . . . . . . . . . . 11-6 11.6 The Members view . . . . . . . . . . . . . 11-7 11.7 The Implementation Editor view . . . . . 11-8 11.8 The Unit Code Editor . . . . . . . . . . . . 11-8 11.9 The Diagram Editor . . . . . . . . . . . . . 11-9 12.1 Bitmap-dimension dialog box from the BMPDlg unit . . . . . . . . . . . . . . 12-21 17.1 TListBox set to bdLeftToRight . . . . . . .17-5 17.2 TListBox set to bdRightToLeft . . . . . . .17-5 17.3 TListBox set to bdRightToLeftNoAlign . . . . . . . . . . .17-5 17.4 TListBox set to bdRightToLeftReadingOnly . . . . . . . .17-5 19.1 Generic Database Architecture . . . . . . .19-6 19.2 Connecting directly to the database server. . . . . . . . . . . . . . . .19-8 19.3 A file-based database application . . . . .19-9 19.4 Architecture combining a client dataset and another dataset . . . . . . . . . . . . 19-12 19.5 Multi-tiered database architecture . . . . 19-13 20.1 TDBGrid control . . . . . . . . . . . . . . 20-15 20.2 TDBGrid control with ObjectView set to False . . . . . . . . . . . . . . . . . 20-23 20.3 TDBGrid control with Expanded set to False . . . . . . . . . . . . . . . . . 20-23 20.4 TDBGrid control with Expanded set to True. . . . . . . . . . . . . . . . . . 20-24 20.5 TDBCtrlGrid at design time . . . . . . . 20-28 20.6 Buttons on the TDBNavigator control . . . . . . . . . . . . . . . . . . . 20-29 22.1 Decision support components at design time . . . . . . . . . . . . . . . . . 22-2 22.2 One-dimensional crosstab . . . . . . . . . 22-3 22.3 Three-dimensional crosstab . . . . . . . . 22-3 22.4 Decision graphs bound to different decision sources. . . . . . . . . . . . . . 22-15 26.1 Components in a BDE-based application. . . . . . . . . . . . . . . . . . 26-2 31.1 Web-based multi-tiered database application. . . . . . . . . . . . . . . . . 31-31 33.1 Parts of a Uniform Resource Locator . . . . . . . . . . . . . . . . . . . . 33-3 34.1 Structure of a Server Application . . . . . 34-4 35.2 Web App Components dialog. . . . . . . 35-9 35.3 Web App Components dialog with options for login support selected . . . 35-14 35.4 An example of a login page as seen from a Web page editor . . . . . . . . . 35-16 35.5 Generating content flow . . . . . . . . . 35-24 35.6 Action request and response . . . . . . 35-26 35.7 Image response to a request . . . . . . . 35-27 35.8 Dispatching a page . . . . . . . . . . . . 35-28 36.2 The main form of the IntraWeb application. . . . . . . . . . . . . . . . . . 36-5 40.1 A COM interface . . . . . . . . . . . . . . 40-3 40.2 Interface vtable . . . . . . . . . . . . . . . 40-5 40.3 In-process server . . . . . . . . . . . . . . 40-7 40.4 Out-of-process and remote servers . . . . 40-8 40.5 COM-based technologies . . . . . . . . .40-11 40.6 Simple COM object interface . . . . . . 40-20 40.7 Automation object interface . . . . . . . 40-20 40.8 ActiveX object interface . . . . . . . . . 40-20 40.9 Delphi ActiveX framework . . . . . . . 40-23 41.1 Type Library editor . . . . . . . . . . . . . 41-3 41.2 Object list pane . . . . . . . . . . . . . . . 41-5 43.1 Dual interface VTable . . . . . . . . . . 43-14 45.1 Mask Edit property page in design mode. . . . . . . . . . . . . . . . 45-13 46.1 The COM+ Events system . . . . . . . . 46-21 Figures
  • 33. I n t r o d u c t i o n 1-1 C h a p t e r 1 Chapter1Introduction The Developer’s Guide describes intermediate and advanced development topics, such as building client/server database applications, creating Internet Web server applications, and writing custom components. 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 editions 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 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 develop cross-platform applications that can be compiled and run on either Windows or Linux platforms. 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
  • 34. 1-2 D e v e l o p e r ’ s G u i d e M a n u a l c o n v e n t i o n s 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. You can access several types of databases, including local databases such as Paradox and dBASE, and network SQL server databases such as InterBase, Oracle, and Sybase. You can choose from a variety of data access mechanisms, including dbExpress, InterbaseExpress, and ADO. To implement the more advanced database applications, you need the features that are not available in all editions. • 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, with which you can create cross-platform server applications; WebSnap, with which you can design Web pages in a GUI environment; support for working with XML documents; and BizSnap, 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 editions. • 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. A Type Library editor simplifies the development of COM servers. Support for COM controls and ActiveX controls is not available in all editions of Delphi. 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 Delphi 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 Delphi keywords or compiler options. Boldface is also used to emphasize certain words, such as new terms. Italics Italicized words in text represent Delphi identifiers, such as variable or type names. Keycaps This typeface indicates a key on your keyboard. For example, “Press Esc to exit a menu.”
  • 35. I n t r o d u c t i o n 1-3 D e v e l o p e r s u p p o r t s e r v i c e s Developer support services Borland offers a variety of support options, including free services on the Internet, where you can search our extensive information base and connect with other users of Borland products, technical support, and fee-based consultant-level support. For more information about Borland’s developer support services, please see our Web site at http://www.borland.com/devsupport/delphi, call Borland Assist at (800) 523-7070, or contact our Sales Department at (831) 431-1064. For customers outside of the United States of America, see our Web site at http://www.borland.com/bww. 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. When contacting support, be prepared to provide complete information about your environment, the version and edition of the product you are using, and a detailed description of the problem.
  • 36. 1-4 D e v e l o p e r ’ s G u i d e
  • 37. P r o g r a m m i n g w i t h D e l p h i P a r t I PartIProgramming with Delphi The chapters in “Programming with Delphi” introduce concepts and skills necessary for creating applications using any edition of Delphi.
  • 39. D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-1 C h a p t e r 2 Chapter2Developing applications with Delphi Borland Delphi is an object-oriented, visual programming environment to develop 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 suite of Rapid Application Development (RAD) design tools, including programming wizards and application and form templates, and supports object-oriented programming with a comprehensive class library that includes: • The Visual Component Library (VCL), which includes objects that encapsulate the Windows API as well as other useful programming techniques (Windows). • The Borland Component Library for Cross-Platform (CLX), which 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, 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 IDE provides all the tools you need to design, develop, test, debug, and deploy applications, allowing rapid prototyping and a shorter development time. The IDE includes all the tools necessary to start designing applications, such as the: • Form Designer, or form, a blank window on which to design the user interface (UI) for your application. • Component palette for displaying visual and nonvisual components you can use to design your user interface.
  • 40. 2-2 D e v e l o p e r ’ s G u i d e D e s i g n i n g a p p l i c a t i o n s • Object Inspector for examining and changing an object’s properties and events. • Object TreeView for displaying and changing a components’ logical relationships. • Code editor for writing and editing the underlying program logic. • Project Manager for managing the files that make up one or more projects. • Integrated debugger for finding and fixing errors in your code. • Many other tools such as property editors to change the values for an object’s property. • Command-line tools including compilers, linkers, and other utilities. • Extensive class libraries with many reusable objects. Many of the objects provided in the class library are accessible in the IDE from the Component palette. By convention, the names of objects in the class library begin with a T, such as TStatusBar. Names of objects that begin with a Q are based on the Qt library and are used for cross-platform applications. Some tools may not be included in all editions of the product. 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, dialog boxes, and windows. Designing applications You can design any kind of 32-bit application—from general-purpose utilities to sophisticated data access programs or distributed applications. As you visually design the user interface for your application, the Form Designer generates the underlying Delphi 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. You can create your own components using the Delphi language. Most of the components provided are written in Delphi. 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 design applications that run on both Linux and Windows by using CLX components. CLX contains a set of classes that, if used instead of those in the VCL, allows your program to port between Windows and Linux. Refer to Chapter 15, “Developing cross-platform applications” for details about cross-platform programming and the differences between the Windows and Linux environments. If you are using Kylix while developing cross-platform applications, Kylix also
  • 41. D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-3 C r e a t i n g p r o j e c t s 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. Chapter 8, “Building applications, components, and libraries,” introduces support for different types of applications. Creating projects All 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. 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, and compiler. These project options are stored in the project file with the project. Units and forms are the basic building blocks of an 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.
  • 42. 2-4 D e v e l o p e r ’ s G u i d e E d i t i n g c o d e Editing code The 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 changes 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 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, and project files—can be viewed and edited in the Code editor. Compiling applications When you have finished designing your application interface on the form and 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 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 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. Note To compile a CLX application on Linux, you need Kylix.
  • 43. D e v e l o p i n g a p p l i c a t i o n s w i t h D e l p h i 2-5 D e b u g g i n g a p p l i c a t i o n s Debugging applications With the integrated debugger, you can 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 variable values, 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 are classes, like other classes in Delphi, except, by convention, they begin with an initial E rather than a T. Deploying applications Delphi includes add-on tools to help with application deployment. For example, InstallShield Express (not available in all editions) helps you to create an installation package for your application that includes all of the files needed for running a distributed application. TeamSource software (not available in all editions) is also available for tracking application updates. To deploy a CLX application on Linux, you need Kylix. Note Not all editions have deployment capabilities. Refer to Chapter 18, “Deploying applications,” for specific information on deployment.
  • 44. 2-6 D e v e l o p e r ’ s G u i d e
  • 45. U s i n g t h e c o m p o n e n t l i b r a r y 3-1 C h a p t e r 3 Chapter3Using the component library This chapter presents an overview of the component library that you use while developing applications. The component library includes the Visual Component Library (VCL) and the Borland Component Library for Cross-Platform (CLX). The VCL is for Windows-only development and CLX is for cross-platform development on both Windows and Linux. The component library is extensive, containing both components that you can work with in the IDE and classes that you create and use in runtime code. Some of the classes can be used in any application, while others can only appear in certain types of applications. Understanding the component library The component library is made up of objects separated into several sublibraries, each of which serves a different purpose. These sublibraries are listed in Table 3.1: Table 3.1 Component sublibraries Part Description BaseCLX Low-level classes and routines available for all CLX applications. BaseCLX includes the runtime library (RTL) up to and including the Classes unit. DataCLX Client data-access components. The components in DataCLX are a subset of the total available set of components for working with databases. These components are used in cross-platform applications that access databases. They can access data from a file on disk or from a database server using dbExpress. NetCLX Components for building Web Server applications. These include support for applications that use Apache or CGI Web Servers.
  • 46. 3-2 D e v e l o p e r ’ s G u i d e U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y The VCL and CLX contain many of the same sublibraries. They both include BaseCLX, DataCLX, NetCLX. The VCL also includes WinCLX while CLX includes VisualCLX instead. Use the VCL when you want to use native Windows controls, Windows-specific features, or extend an existing VCL application. Use CLX when you want to write a cross-platform application or use controls that are available in CLX applications, such as TLCDNumber. For more information on writing cross- platform applications, see Chapter 15, “Developing cross-platform applications.” All classes descend from TObject. TObject introduces methods that implement fundamental behavior like construction, destruction, and message handling. Components are a subset of the component library that descend from the class TComponent. You can place components on a form or data module and manipulate them at design time. Using the Object Inspector, you can assign property values without writing code. Most components are either visual or nonvisual, depending on whether they are visible at runtime. Some components appear on the Component palette. Visual components, such as TForm and TSpeedButton, are called controls and descend from TControl. Controls are used in GUI applications, and appear to the user at runtime. TControl provides properties that specify the visual attributes of controls, such as their height and width. Nonvisual components are used for a variety of tasks. For example, if you are writing an application that connects to a database, you can place a TDataSource component on a form to connect a control and a dataset used by the control. This connection is not visible to the user, so TDataSource is nonvisual. At design time, nonvisual components are represented by an icon. This allows you to manipulate their properties and events just as you would a visual control. Classes that are not components (that is, classes that descend from TObject but not TComponent) are also used for a variety of tasks. Typically, these classes are used for accessing system objects (such as a file or the clipboard) or for transient tasks (such as storing data in a list). You can’t create instances of these classes at design time, although they are sometimes created by the components that you add in the Form Designer. VisualCLX Cross-platform GUI components and graphics classes. VisualCLX classes make use of an underlying cross-platform widget library (Qt). WinCLX Classes that are available only on the Windows platform. These include controls that are wrappers for native Windows controls, database access components that use mechanisms (such as the Borland Database Engine or ADO) that are not available on Linux, and components that support Windows-only technologies (such as COM, NT Services, or control panel applets). Table 3.1 Component sublibraries (continued) Part Description
  • 47. U s i n g t h e c o m p o n e n t l i b r a r y 3-3 U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y Detailed reference material on all VCL and CLX objects is accessible through online Help while you are programming. In the Code editor, place the cursor anywhere on the object and press F1 to display the Help topic. Objects, properties, methods, and events that are in the VCL are marked “VCL Reference” and those in CLX are marked “CLX Reference.” Properties, methods, and events Both the VCL and CLX form hierarchies of classes that are tied to the IDE, where you can develop applications quickly. The classes in both component libraries are based on properties, methods, and events. Each class includes data members (properties), functions that operate on the data (methods), and a way to interact with users of the class (events). The component library is written in the Delphi language, although the VCL is based on the Windows API and CLX is based on the Qt widget 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 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 some properties at design time and get immediate feedback as the components change in the IDE. • You can access some properties 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 calls to get and set the values of properties can be 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 a property. For example, changing the value of one property may require you to modify another. You can change the methods created for the property. • Properties can be virtual. • A property is not restricted to a single object. Changing one property on one object can affect several objects. For example, setting the Checked property on a radio button affects all of the radio buttons in the group.
  • 48. 3-4 D e v e l o p e r ’ s G u i d e U n d e r s t a n d i n g t h e c o m p o n e n t l i b r a r y 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 fields of the class and are commonly referred to as member functions. See “Controlling access” on page 2-4 of the Component Writer’s Guide. Although most methods belong to an instance of a class, some methods belong instead to the class type. These are called class methods. 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. For example, the user may choose a menu item, click a button, or mark some text. You can write code to handle the events in which you are interested, rather than writing code that always executes in the same restricted order. Regardless of how an event is triggered, VCL objects look 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 • Internal events User events User events are actions that the user initiates. 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). System events System events are events that the operating system fires for you. For example, the OnTimer event (which the Timer component issues whenever a predefined interval has elapsed), 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. Internal events Internal events are events that are generated by the objects in your application. An example of an internal event is the OnPost event that a dataset generates when your application tells it to post the current record.
  • 49. U s i n g t h e c o m p o n e n t l i b r a r y 3-5 O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s Objects, components, and controls Figure 3.2 is a greatly simplified view of the inheritance hierarchy that illustrates the relationship between objects, components, and controls. Figure 3.1 A simplified hierarchy diagram Every object (class) inherits from TObject. Objects that can appear in the Form Designer inherit from TPersistent or TComponent. Controls, which appear to the user at runtime, inherit from TControl. There are two types of controls, graphic controls, which inherit from TGraphicControl, and windowed controls, which inherit from TWinControl or TWidgetControl. A control like TCheckBox inherits all the functionality of TObject, TPersistent, TComponent, TControl, and TWinControl or TWidgetControl, and adds specialized capabilities of its own. The figure shows several important base classes, which are described in the following table: Table 3.2 Important base classes Class Description TObject Signifies the base class and ultimate ancestor of everything in the VCL or CLX. TObject encapsulates the fundamental behavior common to all VCL/CLX objects by introducing methods that perform basic functions such as creating, maintaining, and destroying an instance of an object. Exception Specifies the base class of all classes that relate to VCL exceptions. Exception provides a consistent interface for error conditions, and enables applications to handle error conditions gracefully. TPersistent Specifies the base class for all objects that implement publishable properties. Classes under TPersistent deal with sending data to streams and allow for the assignment of classes. TComponent Specifies the base class for all components. Components can be added to the Component palette and manipulated at design time. Components can own other components. TObject TGraphicControl Exception TComponent TControl TWinControl* TPersistent [Objects] [Objects] [Objects] [Objects] [Objects] [Objects] * TWidgetControl in cross-platform applications.
  • 50. 3-6 D e v e l o p e r ’ s G u i d e O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s The next few sections present a general description of the types of classes that each branch contains. For a complete overview of the VCL and CLX object hierarchies, refer to the VCL Object Hierarchy and CLX Object Hierarchy wall charts included with this product. TObject branch The TObject branch includes all VCL and CLX classes that descend from TObject but not from TPersistent. Much of the powerful capability of the component library is established by the methods that TObject introduces. TObject encapsulates the fundamental behavior common to all classes in the component library by introducing methods that provide: • The ability to respond when object instances are created or destroyed. • Class type and instance information on an object, and runtime type information (RTTI) about its published properties. • Support for handling messages (VCL applications) or handling notifications (CLX applications). TObject is the immediate ancestor of many simple classes. Classes in the TObject branch have one common, important characteristic: they are transitory. This means that these classes do not have a method to save the state that they are in prior to destruction; they are not persistent. One of the main groups of classes in this branch is the Exception class. This class provides a large set of built-in exception classes for automatically handling divide- by-zero errors, file I/O errors, invalid typecasts, and many other exception conditions. Another group in the TObject branch is classes that encapsulate data structures, such as: • TBits, a class that stores an “array” of Boolean values. • TList, a linked list class. • TStack, a class that maintains a last-in first-out array of pointers. • TQueue, a class that maintains a first-in first-out array of pointers. Another group in the TObject branch are wrappers for external objects like TPrinter, which encapsulates a printer interface, and TIniFile, which lets a program read from or write to an ini file. TControl Represents the base class for all controls that are visible at runtime. TControl is the common ancestor of all visual components and provides standard visual controls like position and cursor. This class also provides events that respond to mouse actions. TWinControl or TWidgetControl Specifies the base class of all controls that can have keyboard focus. Controls under TWinControl are called windowed controls while those under TWidgetControl are called widgets. Table 3.2 Important base classes (continued) Class Description
  • 51. U s i n g t h e c o m p o n e n t l i b r a r y 3-7 O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s TStream is a good example of another type of class in this branch. TStream is the base class type for stream objects that can read from or write to various kinds of storage media, such as disk files, dynamic memory, and so on (see “Using streams” on page 5-2 for information on streams). See Chapter 5, “Using BaseCLX,” for information on many of the classes in the TObject branch (as well as on many global routines in the Delphi Runtime Library). TPersistent branch The TPersistent branch includes all VCL and CLX classes that descend from TPersistent but not from TComponent. Persistence determines what gets saved with a form file or data module and what gets loaded into the form or data module when it is retrieved from memory. Because of their persistence, objects from this branch can appear at design time. However, they can’t exist independently. Rather, they implement properties for components. Properties are only loaded and saved with a form if they have an owner. The owner must be some component. TPersistent introduces the GetOwner method, which lets the Form Designer determine the owner of the object. Classes in this branch are also the first to include a published section where properties can be automatically loaded and saved. A DefineProperties method lets each class indicate how to load and save properties. Following are some of the classes in the TPersistent branch of the hierarchy: • Graphics such as: TBrush, TFont, and TPen. • Classes such as TBitmap and TIcon, which store and display visual images, and TClipboard, which contains text or graphics that have been cut or copied from an application. • String lists, such as TStringList, which represent text or lists of strings that can be assigned at design time. • Collections and collection items, which descend from TCollection or TCollectionItem. These classes maintain indexed collections of specially defined items that belong to a component. Examples include THeaderSections and THeaderSection or TListColumns and TListColumn. TComponent branch The TComponent branch contains classes that descend from TComponent but not TControl. Objects in this branch are components that you can manipulate on forms at design time but which do not appear to the user at runtime. They are persistent objects that can do the following: • Appear on the Component palette and be changed on the form. • Own and manage other components. • Load and save themselves.
  • 52. 3-8 D e v e l o p e r ’ s G u i d e O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s Several methods introduced by TComponent dictate how components act during design time and what information gets saved with the component. Streaming (the saving and loading of form files, which store information about the property values of objects on a form) is introduced in this branch. Properties are persistent if they are published and published properties are automatically streamed. The TComponent branch also introduces the concept of ownership that is propagated throughout the component library. Two properties support ownership: Owner and Components. Every component has an Owner property that references another component as its owner. A component may own other components. In this case, all owned components are referenced in the component’s Components property. The constructor for every component takes a parameter that specifies the new component's owner. If the passed-in owner exists, the new component is added to that owner's Components list. Aside from using the Components list to reference owned components, this property also provides for the automatic destruction of owned components. As long as the component has an owner, it will be destroyed when the owner is destroyed. For example, since TForm is a descendant of TComponent, all components owned by a form are destroyed and their memory freed when the form is destroyed. (Assuming, of course, that the components have properly designed destructors that clean them up correctly.) If a property type is a TComponent or a descendant, the streaming system creates an instance of that type when reading it in. If a property type is TPersistent but not TComponent, the streaming system uses the existing instance available through the property and reads values for that instance’s properties. Some of the classes in the TComponent branch include: • TActionList, a class that maintains a list of actions, which provides an abstraction of the responses your program can make to user input. • TMainMenu, a class that provides a menu bar and its accompanying drop-down menus for a form. • TOpenDialog, TSaveDialog, TFontDialog, TFindDialog, TColorDialog, and so on, classes that display and gather information from commonly used dialog boxes. • TScreen, a class that keeps track of the forms and data modules that an application creates, the active form, the active control within that form, the size and resolution of the screen, and the cursors and fonts available for the application to use. Components that do not need a visual interface can be derived directly from TComponent. To make a tool such as a TTimer device, you can derive from TComponent. This type of component resides on the Component palette but performs internal functions that are accessed through code rather than appearing in the user interface at runtime. See Chapter 6, “Working with components,” for details on setting properties, calling methods, and working with events for components.
  • 53. U s i n g t h e c o m p o n e n t l i b r a r y 3-9 O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s TControl branch The TControl branch consists of components that descend from TControl but not TWinControl (TWidgetControl in CLX applications). Classes in this branch are controls: visual objects that the user can see and manipulate at runtime. All controls have properties, methods, and events in common that relate to how the control looks, such as its position, the cursor associated with the control’s window, methods to paint or move the control, and events to respond to mouse actions. Controls in this branch, however, can never receive keyboard input. Whereas TComponent defines behavior for all components, TControl defines behavior for all visual controls. This includes drawing routines, standard events, and containership. TControl introduces many visual properties that all controls inherit. These include the Caption, Color, Font, and HelpContext or HelpKeyword. While these properties inherited from TControl, they are only published—and hence appear in the Object Inspector— for controls to which they are applicable. For example, TImage does not publish the Color property, since its color is determined by the graphic it displays. TControl also introduces the Parent property, which specifies another control that visually contains the control. Classes in the TControl branch often called graphic controls, because they all descend from TGraphicControl, which is an immediate descendant of TControl. Although these controls appear to the user at runtime, graphic controls do not have their own underlying window or widget. Instead, they use their parent’s window or widget. It is because of this limitation that graphic controls cant receive keyboard input or act as a parent to other controls. However, because they do not have their own window or widget, graphic controls use fewer system resources. For details on many of the classes in the TControl branch, see “Graphic controls” on page 10-19. There are two versions of TControl, one for VCL (Windows-only) applications and one for CLX (cross-platform) applications. Most controls have two versions as well, a Windows-only version that descends from the Windows-only version of TControl, and a cross-platform version that descends from the cross-platform version of TControl. The Windows-only controls use native Windows APIs in their implementations, while the cross-platform versions sit on top of the Qt cross- platform widget library. See Chapter 7, “Working with controls,” for details on how to interact with controls at runtime.
  • 54. 3-10 D e v e l o p e r ’ s G u i d e O b j e c t s , c o m p o n e n t s , a n d c o n t r o l s TWinControl/TWidgetControl branch Most controls fall into the TWinControl/ TWidgetControl branch. Unlike graphic controls, controls in this branch have their own associated window or widget. Because of this, they are sometimes called windowed controls or widget controls. Windowed controls all descend from TWinControl, which descends from the windows-only version of TControl. Widget controls all descend from TWidgetControl, which descends from the cross-platform version of TControl. Controls in the TWinControl/TWidgetControl branch: • Can receive focus while an application is running, which means they can receive keyboard input from the application user. In comparison, graphic controls can only display data and respond to the mouse. • Can be the parent of one or more child controls. • Have a handle, or unique identifier, that allows them to access the underlying window or widget. The TWinControl/TWidgetControl branch includes both controls that are drawn automatically (such as TEdit, TListBox, TComboBox, TPageControl, and so on) and custom controls that do not correspond directly to a single underlying Windows control or widget. Controls in this latter category, which includes classes like TStringGrid and TDBNavigator, must handle the details of painting themselves. Because of this, they descend from TCustomControl, which introduces a Canvas property on which they can paint themselves. For details on many of the controls in the TWinControl/TWidgetControl branch, see Chapter 10, “Types of controls.”
  • 55. Another Random Scribd Document with Unrelated Content
  • 56. hundred years after. The wrong done the body politic may fester unseen, but it festers on all the same. Fortunately for the people there is yet a feature in the situation that gives us hope. We are blessed with no inconsiderable body of men of sufficient sense and conscience to rise above party control and vote in support of good measures and honest, capable men. These are not men dominated by one idea, and devoted to some one measure that is to remedy all our political ills. These are "cranks," so called, because they believe that human nature is constructed like machinery—something like a coffee-mill that has a crank that, if turned and turned vigorously, will put the entire machine in good running order. To some this is temperance, to others the tariff, to a third our common-school system: and so they give their lives to a vociferous demand for help to turn the one peculiar crank. We refer, not to such as these, but the thoughtful, patriotic few who rise above party obligations to a consideration of their country's good. These men are not organized into a party,—unless the fact of two men thinking and feeling alike make a party,—and, as compared to the Republican and Democratic camp-followers, are few in number. But, in the evenly divided condition of the two organizations, these men hold the balance of power, and are dreaded in consequence. Had it not been for the money used by Republicans, and the treachery practised by a few leading Democrats, these independents would have given New York to the Democracy, and Grover Cleveland would be President for the next four years. These men are derided, scoffed at, and held in high disdain by the partisans of both parties. They are called Mugwumps; and when this strange epithet is hurled at them the assailant seems to feel relieved. This is no new thing. Among the traditions of the Church is one to the effect that as the devil talks he spits fire. All reformers are treated to this. It is well remembered that in the troublous times of '61 the Mugwumps, then denounced as Abolitionists, came to the front and carried the government through its dark hour of peril to a
  • 57. triumphant close. They were brave, brainy, patriotic men, not disturbed by the abuse heaped upon them. We are comforted to observe the power of these few men as proved in the debate on the civil-service law of the House when an appropriation was called for to sustain the Commission. The debate proved what we all know—that probably not a member of the House but regards the reform in utter loathing and wrath. And yet, when the vote was taken, but a small minority were willing to put themselves on record in opposition. The same clear appreciation of the evil consequences attending this corruption of the ballot, and the conscience that makes itself felt as that of the people, are forcing a reform in that direction. The time is not distant when the now much- reviled Mugwumps will be regarded, as are the Abolitionists, as the true patriots of the day. God would have forgiven Sodom and Gomorrah could five righteous men have been found in either city: this not out of regard for the five, but from the evidence afforded that if that number existed, these wicked places could not be altogether lost. OUR HOUSE OF LORDS. The dignity of this unnecessary and disagreeable body was somewhat disturbed by a Senator in a wild state of intoxication, who from his place in the Chamber assailed in unseemly language the presiding officer. Great consternation fell upon the British House of Commons when the discovery was made that an entire session had been gone through without "that bauble," as Oliver Cromwell called it, being upon the table. When Doctor Kenealy, friend and attorney of the Tichborne Claimant, was about being sworn in as a member of Parliament, it was observed that he had a cotton umbrella under his arm. A horror too profound for utterance fell upon the House, and all
  • 58. proceedings were arrested until the obnoxious compound of cotton and whalebone was removed. We refer to these events for the purpose of impressing upon our delegated sovereigns from sovereign States, that unless the proprieties are preserved their dignity cannot be maintained. What would be thought of the British House of Lords if Lord Tomnoddy, for example, were to roll in very drunk, and make personal remarks touching the integrity of the presiding officer? The thought of such an event threatens insanity. The British Empire would totter, the throne shake, and the House of Lords disappear forever. The inebriated Senator was not arrested, or even rebuked. We all know why. On his one vote depends the Republican control of the Senate. To seize upon, arrest, and cart away, under charge of drunken and disorderly conduct, the Republican majority of the Senate was so preposterous as not to be entertained. As force could not be used, strategy was resorted to, and the inebriate Solon was invited out to take more drinks, in the hope that a little more liquid insanity would render him hors de combat. This is not the first instance of embarrassment of like sort. When the men who organized the Star Route dishonesty of the Post-office Department were indicted, it was found that the head and front of this offending was a United States Senator. He held the one vote that gave his party its supremacy in the Senate. To send the Republican majority vote to the penitentiary was not to be thought of—and so the court was packed to acquit. A body that subordinates its dignity to the supremacy of a party cannot long retain that awe-inspiring respect so necessary to its existence. Our House of Lords should bear in mind that the only reason—if such it may be called—for its existence, is in this dignity. If the Senate is not the holy, embalmed mummy of a dead king once known as State sovereignty, it is naught; therefore, when a Senator endangers this title to existence by unseemly conduct, either as an
  • 59. inebriate or as a bribe-taker, he should be incontinently expelled. The expulsion should be conducted with great ceremony. He should be divested of his robes in the presence of the august body—robes being procured for the occasion. One might be borrowed from the Supreme Court. Then the culprit should be conducted by two assistant Sergeants-at-Arms, one having hold of each arm. The Sergeant-at-Arms should march behind, bearing the mace. We believe the Senate has that utensil; if not, that of the House of Representatives could be procured. At the main entrance the Sergeant-at-Arms should fetch the mace into a charge, and planting the eagle in the small of the culprit's back, thrust him out. All the while the chaplain, in a solemn but distinct voice, should read the Service for the Dead. After, the presiding officer should give three distinct raps of his ivory gavel, and say in joyous but decorous voice, indicative of triumphant yet seemly satisfaction: "The expurgated Senate will now proceed with the business of legislating for the House of Representatives." So necessary is dignity to the existence of this august body, that the presiding officer should have an eye continually to it; and when a Senator, in debate, makes himself ridiculous, he should at once be called to order. When, for example, the Hon. Senator from Vermont (Mr. Edmunds) gave his grotesque picture of a common American laborer being possessed of a piano, and a wife in silk attire, in his own cottage home, he should have been promptly called to order. The presiding officer should have remarked that the picture, being imperfect, was in a measure untrue, and as such could not be entertained by the Senate. The Senator, however, has the privilege of amending his sketch by saying that the laborer has not only the luxury found in a piano and silk-clad wife, but a mortgage on the premises. This, although improbable, is not impossible for a common laborer; and if the Hon. Senator will vouch for the fact that he knows one such, his statement may go on record for what it is worth. This would serve to abridge the liberty of speech guaranteed to us by the Constitution. But we must remember that the same larger
  • 60. freedom exercised in a bar-room, or upon the streets, or on the floor of the House of Representatives, is a menace to the dignity of the Senate; and in view of this, freedom of speech is somewhat circumscribed. When, therefore, the Hon. Senator from Indiana (Mr. Voorhees) shakes his senatorial fist at the Hon. Senator from Kansas (Mr. Ingalls), and calls him an anathematized offspring of a female canine, or words to that effect, he fractures the dignity of the Senate, and further adjudication does not turn on the truth of the utterances as in a court, for we are forced to remember that it is one-half of the sovereign State of Indiana shaking its fist at one half of the sovereign State of Kansas. This is very like the old story of the sheriff of Posey County, Kentucky, who being agitated in a robust manner by an angry citizen, called on his assailant to desist, as he was "shaking all Posey County." How long the practical common-sense citizens of the United States will submit to this worn-out superstition of a Senate is a question that strikes every thoughtful mind. The body was born of a narrow sectional feeling, long before steam navigation and railroads made the continent more of one body than was a single colony before the Revolution; and was a concession to State sovereignty, with the new and accepted principle of home rule found in State rights. It further confuses and demoralizes the civil rule of the majority under the Constitution, as it gives to Rhode Island or Delaware the same power held by New York or Pennsylvania. It was believed by the framers of our government that it would be a conservative body, and serve as a restraint upon the popular impulses to be expected from the House. This has not proved to be the fact. The tenure of office given a Senator is of such length that it weakens the only control found in public opinion, and this august body is more extravagant, corrupt, and impulsive than the more popular body at the other end of the Capitol. If any one doubts this, let such doubter follow any appropriation bill, say that highway robbery called the River and Harbor Appropriation, or pensions, from the House to the Senate.
  • 61. The Senate has long since survived its usefulness, if it ever had any; is to-day an object of contempt; and the sooner we have done with it the better off we shall be. OUR DIPLOMATIC ABSURDITY. There is a deep-felt apprehension indulged in by a class of our citizens over the grave diplomatic complication found in the dismissal of Lord Sackville West, and the refusal on the part of Her Gracious Majesty of England to refill the vacant post at Washington with another lord. Our national dignity is menaced so long as Mr. Phelps, envoy extraordinary and minister plenipotentiary residing at or near St. James's, is permitted to remain. As soon as Sackville "got the sack," to use a vulgar but expressive phrase, a reasonable time should have been given Her Gracious Majesty to fill the place; and failing, the Hon. Phelps should have been promptly recalled. This would have been hard on the Hon. Phelps, but with our flag insulted and our eagle scoffed at by an empty legation at the national capital, the Hon. Phelps should have been prepared to wrap the star- spangled banner about his diplomatic body and die—if need be—to the fierce screams of the eagle. He might, after such a glorious demise, have been consigned to that corner of Westminster Abbey that Dean Stanley reserved for a distinguished American. It is true that we, in common with the American people, have designated Senator Ingalls as the one selected for that honor, and we are prepared to kill him any time, and forward his remains to the spot, provided the Westminster people are willing to receive them. But this is carrying us from our diplomatic mutton. Under the circumstances, it is a comfort to know that all this apprehension of these sensitive citizens is quite uncalled for. This because we have no diplomatic service, no diplomatic agents, and therefore no complications to speak of.
  • 62. The framers of our government, through some oversight, neglected to supply us with a diplomatic service. They saw, it is true, no use for such; nor was it possible to have a government as a trust, and give it such powers. The diplomatic service pertains exclusively to a personal government. It originated in a sovereign delegating certain powers, attributes of the crown, to official agents whose duty was to reside near the courts of other sovereigns, keep a watchful eye upon their movements, report the same to their masters, and, from time to time, negotiate treaties of advantage to their own sovereigns. To give these diplomatic agents dignity and influence they were clothed with sufficient power to commit their sovereigns to their official acts. This is not possible with us. The sovereignty in our great republic is in the people; and it finds expression, in this direction, through the Executive and Senate. It cannot be delegated. When, therefore, a treaty is negotiated between us and any foreign power, it is necessary to send a special envoy to Washington to deal with the Executive. This has to be sanctioned by the Senate: and our absurd House of Lords has served notice on the world that the President himself cannot commit our government to any treaty. Why, then, are our diplomatic agents, so called, sent abroad as ministers? Ministers resident and chargés d'affaires are merely clerks of the State Department—no more, no less—who are sent abroad to play at being diplomatists and get laughed at by the courts they approach. The diplomatic corps of Europe, being an important part of their several governments, is made up of men possessed of fine intellect and great culture. To meet and associate with such, we send prominent politicians who, being such, are ignorant of their own government, its history and character, let alone those of Europe; and they are tolerated from a good-natured wish to be agreeable, where there is no profit in being otherwise. We do not suffer in this so much from our lack of good breeding—for it is difficult for a prominent American to be other than a gentleman—as we do from
  • 63. the ignorance of our official agents. Ex-President Grant, for example, in his famous trip round the world, posed at every court he approached as a royal personage. General Badeau ("Adjutant-in- waiting"), acting as grand master of ceremonies, arranged the household, and exacted from all comers the etiquette due a sovereign. If our good citizens could have known the ripple of laughter and ridicule that followed the result, in which our great man was spoken of as "the King of the Yankee Doodles," they would be more ashamed than proud of the performance. It is this ignorance of ourselves and our political fabric that places us in a false position before the world. The clerk of the State Department sent abroad by our government as a diplomatic agent, instead of putting up at a hotel and opening an office in a common business way, sets up an establishment and "takes on airs." As most of the diplomatic business is done in a social way, he attempts to entertain on a salary entirely inadequate to such work. As a court costume is necessary—which means the sort of livery the diplomatic agent affects in the presence of his own sovereign—and as we, having no king, have no livery, our department clerk borrows one, either from some European court or the theatre, and dances attendance in that. No man ever stood higher in the estimation of the world, on account of his genius, than James Russell Lowell. That esteem was considerably shaken, in the eyes of an admirer, when, calling on his minister at London, he found the poet's slender legs encased in tights, and his little body clad in a gorgeous coat covered with gold buttons. Of course, Mr. Lowell could masquerade in any dress and remain the brilliant poet and patriot; but the significance of this livery, its shallow pretence and humble admission, made the admirer sick. The clerk of our State Department sent abroad under this state of facts finds nothing to do. He is not interested in the business of the foreign diplomatic corps; and if he were, his government has no hand in the game, nor is the agent sufficiently instructed to take part
  • 64. even were he interested. He is tolerated by those with whom he comes in contact, and his strange associates repay their good-nature by the amusement they get out of the poor fellow. There is no provision in our government for such an absurdity. The framers of our Constitution provided none; and if our recollection serves us right, it was not until 1856 that Congress recognized its existence by a law fixing the rank and compensation. The thing ought to be abolished. When Andrew Jackson was first elected President, he went to Washington fully resolved to put an end to the absurd business. The politicians were too much for Old Hickory—and so they are to-day too much for common-sense, the letter and spirit of our government, and the dignity of our people. With a House of Lords at home and a so-called diplomatic corps abroad, we are an object of contempt from the rising of the sun till the setting thereof.
  • 65. THE PASSING SHOW. Sensationalism in art, as in literature, no doubt has its uses. It serves to present old truths in a new light, and by a startling grouping of ascertained facts helps to overcome the inertia of the average man and make him think. There is a value in novelty, provided it is rightly used, which is an important aid to the playwright or scenic artist. But where sensationalism is manifested by a distortion of facts, a falsification of history, or a violation of the principles of human nature, its effect is demoralizing both to the artist and the spectator, the author and the reader. Such an innovation has been attempted by Mr. Henry Irving and Miss Ellen Terry in their presentation of "Macbeth" at the Lyceum Theatre, London. It is excellent acting, faithful reproduction of historic costumes, exquisite scenery, but—it is not Shakspere. Nor is it human nature. Had it been only occasional alterations of the dramatist's lines, or even the unnecessary division of the play into six acts instead of five, or the cutting out of some of the characters, the genius of Irving and Terry might have been pardoned the perversion. But when they attempt to represent the ambitious, plotting, fiendish murderess whom Shakspere has depicted, as a loving, devoted wife, who only seeks to further a little job of killing for the purpose of promoting her husband's interests, they meet with an infallible critic in the heart of every intelligent spectator. It is against human nature, and no amount of wonderful declamation or scenic magnificence can gloss it over. The purpose of art is to portray nature, to refine it if you will, but never to contradict. Lovers of the drama will be bitterly disappointed that Mr. Irving, after having devoted the best years of his life to the former, should at this late day, for the mere sake of innovation, resort to the latter.
  • 66. Shakspere, the great philosopher of human nature as well as the greatest dramatist of the centuries, knew full well that unlawful ambition which includes crime excludes the tender, womanly devotion of the true wife, and, far from picturing Lady Macbeth as an admirer of her husband, shows her as sneering at him for his want of courage: "Yet do I fear thy nature; Is too full o' the milk of human kindness." "Hie thee hither, That I may pour my spirits in thine ear." And this: "We fail. But screw your courage to the sticking-place." Irving and Terry's play is not human nature and is not Shakspere; but, overlooking these points, their conception is well carried out. It is a wonderful spectacle. The resources of stage machinery have been taxed to their utmost, and the English press is one chorus of admiration at the marvellous landscapes, and at the quaint ornamentation and the low, groined arches of the old Saxon castle. It is a pity that these valuable adjuncts were not called unto the aid of a more correct interpretation of the great ideal. And now we are likely to have an epidemic of Macbeths. Margaret Mather has tried it at Niblo's, and Mrs. Langtry has been incubating a new presentation, like Terry's, with a "few innovations." Irving's reputation as a stage manager is such that when his "Macbeth" comes to America everyone will want to see it. But will it ever come to America? For now, forsooth, there are some members of the dramatic profession in this country who avow their intention of appealing to Congress to regulate American taste by law, and to exclude foreign actors under the contract-labor statute.
  • 67. This brilliant idea originated in the fertile brain of Mr. Louis Aldrich, and was nursed by the Actors' Order of Friendship. Into this Order Messrs. Booth and Barrett were initiated with darkened windows and mysterious rites, for the express purpose of fixing the stamp of their approval upon the scheme. A delegation appeared before Congressman Ford's Immigration Committee and begged that the proposed undemocratic exclusion law shall contain a provision against the landing of foreign pauper actors. But these gentlemen lacked in logic what they possessed in assurance. They were willing to except "stars" from the operation of the law. Well, why not exclude "stars"? Do they not compete quite as much with American talent as the humbler aspirants of the stage? Even a "star" of the magnitude of Louis Aldrich himself would probably find his rays outshone in the presence of the brighter effulgence of an Irving or a Coquelin. It is the "stars" who compete most with native talent, and on this principle they should be the first excluded. Besides that, if they are excepted, who is to define a "star"? It would be amusing to see the Supreme Court of the United States gravely sitting in judgment on such a question. By all means, Mr. Aldrich, return at once to Washington and amend your petition. Let Mr. Ford include "stars" also in his bill. And then let every protectionist crank in the country have absolute exclusion of every possible competitor and of all kinds of goods that he wants to sell, and pay a bounty to the farmers for their crops, and then we shall all be able to raise ourselves by our boot-straps into a region of perfect happiness. Of course there are two sides to every question, and, not wishing to do an injustice, we will give the one maintained by the petitioners. We have a law prohibiting the importation of labor contracted for abroad. This law the courts hold is applicable to cooks, coachmen, and ministers of the Gospel. Now why should an exception be made in behalf of a theatrical manager who contracts for a lot of actors, more or less cheap, in London, to play for him in the United States? Mr. Aldrich does not ask that the man, be he star or stock, who
  • 68. comes of his own motives shall be prohibited; but he does protest against the importation of the cheap histrionic labor which is brought here, precisely as other skilled or unskilled labor is got over, to compete with the same labor in the United States. In other words, it is not a question of taste, but one of bread. Another fact is overlooked that has a decided bearing on the question. In all matters of art we are such a set of snobs that we cannot recognize any merit in our artists until after they have been indorsed by English critics and English audiences. If any law can be enacted to correct this miserable condition, let us have it at an early day. We know that the greatest actress known to the English- speaking world—our Clara Morris—has failed to secure the fame and fortune to which her genius entitled her simply because she neglected to secure English approbation—which would have been heartily given her had she ever appeared in London. Nor is it true that English stock is preferred to the American product because of its superior excellence. Mr. Daly has shown the absurdity of this claim by taking his admirable company to London and carrying off the honors. In the face of this and every other fact, we are told that the English comedian doing the society drama is superior to ours because of his superior social position. That is something to be relegated to the things which amuse. There is an adaptability about the American that makes him at home in all conditions. It is possible for an American actor to wear a dress suit with an ease that is rivalled only by the French. What is the good of calling on an Englishman to do on the stage what no Englishman can accomplish in private life? If there is a John Bull on earth who can wear a dress suit with ease and elegance, he has not yet been discovered. There now, we have given both sides. Mr. Edwin Booth offered his brother-actors a much better kind of protection when, on New Year's Eve, he presented to them "The Players'" club-house, with its fine library and its treasures of
  • 69. dramatic art. After all, education and self-development are the only legitimate means of attaining success; and he who offers his fellow- beings facilities for improvement and self-help is a far greater benefactor to them than he who endeavors to apply restrictive methods. Such an institution has been Mr. Booth's dream for years. It is a spacious house at No. 16 Gramercy Place, adjoining the residence of the late Samuel J. Tilden. Mr. Booth purchased it for $75,000, and spent $125,000 in alterations. The library is probably the finest collection of dramatic literature in the world. Twelve hundred volumes were presented by Mr. Booth, and two thousand by Lawrence Barrett, besides a large number of rare works given by Augustin Daly, T. B. Aldrich, Laurence Hutton, and others. It was a touching scene when, a few moments before the old year died, Mr. Booth placed in the hands of Augustin Daly for the Players' Club the title-deeds to this magnificent property, and blushing like a girl before the assembled actors, listened awkwardly to the simple words which Mr. Daly spoke in reply. Then just after the midnight bells had rung he turned and lit the Yule log, and the players began the enjoyment of their new home. A few days afterwards Mr. Booth closed his very successful metropolitan engagement at the Fifth Avenue Theatre with "The Fool's Revenge," Lawrence Barrett appearing in "Yorick's Love," and both the tragedians started on a Southern tour. Miss Mary Anderson appears in a late issue of a sensational publication as a severe censor of society ladies addicted to attempts upon the stage. We say Mary Anderson; for her name appears at the end of the article, and as she is a woman, we will not venture to say that the property claimed is not her own. Some rude critics have charged that Mary did not make this up out of her own fair head; and throughout the profession a state of mind exists that is not complimentary to the would-be authoress. The queerest part of the business, however, is, that such strictures should come from Miss Anderson. She raided the stage as a society woman, and struck at once for the honors. There was, if we
  • 70. remember rightly, no long, weary preparation and laborious training for the footlights. She went from the parlor to the greenroom, and she went in with a flourish. She was of Kentucky birth, and Henry Watterson, whose bright intellect is only surpassed by his good heart, not only indorsed the ambitious society girl, but made up his mind to put Mary down the American throat whether the people would or not. Mary was not unpalatable to the American taste, but Watterson is her father—that is, dramatically speaking. Then Stepfather Griffin came in. Stepfather Griffin was born a theatrical advance and advertising agent. He did not know this. If we were to dwell on what Stepfather Griffin does not know, we should fill all the space of this magazine for the year. P. Griffin "caught on" to the provincial condition of our artistic, literary, and dramatic life, which makes the approval of England necessary to American success. So Poppy G. transported his American star to London. He found the Prince of Wales necessary; and Labouchere, M. P. and proprietor of Truth, taught the paternal agent how to work the oracle. The Prince of Wales is a corpulent, good-natured son of Her Gracious Majesty who rules all the earth save Ireland. He is ever open to the advances and blandishments of an American woman, or African woman, or any sort of woman, provided she is lovely; and being approached, he expressed his desire to know the star of Columbia. "Now," said Labouchere, "having got that far, the thing to startle England and capture Americans is for Mary to decline an introduction on high moral and republican grounds." This was done, and Great Britain was startled and the Yankee Doodles were captured. She returned to her native land with an English troupe, and made Yankee Doodle go wild. Now Mary is absolutely the worst actress ever sent sweeping from the drawing-room to the footlights. Possessed of a tall, angular figure, and blessed with a sonorous and in some respects pliable voice, she has the fatal gift of imitation. No actor can win the highest honors of his exalted profession who is a mimic. The actor capable of giving expression to the thought of his author really
  • 71. assists that author in the creation of a character. He or she is the creator. Now the mimic is one who reproduces second-hand the work of others. We are cursed with a traditionary assortment of characters that have come down to us from the Kembles; and any one capable of filling what Shakspere or Bacon or somebody called the rôle of "a poor player who struts and frets his hour upon the stage, and then is heard no more" can win applause through mimicry, but never be great. We first saw Mary as Meg Merrilies, and the reproduction of Cushman was something marvellous. And so we have had it ever since. As Fechter said of Booth's Hamlet, that "he played everybody's Hamlet but his own," so it may be said of Miss Anderson, that she reproduces in an acceptable way the wearisome line of old characters that have come to be stage properties. Mrs. James Brown Potter, who has been playing to New York and Brooklyn audiences in Tom Taylor's heavy drama, "'Twixt Axe and Crown," shows considerable improvement over her acting of one year ago, but she chose a very inappropriate piece for her reappearance. Mrs. Potter reads her lines very well, is a very beautiful woman, and possesses that indispensable adjunct of the modern actress, a very handsome wardrobe. But she is not fitted for the part of Lady Elizabeth, who in her youthful prison exhibits the same wilful capriciousness and headstrong pride that she afterwards showed on England's throne. Mr. Kyrle Bellew as Edward Courtenay, the romantic lover of Elizabeth, played his rôle quite well. Mrs. Potter is naturally better suited to fragile, feminine, girlish parts than she is to the heroic, and there is plenty of room for improvement; but she is painstaking, persistent, and has time before her. Edward Harrigan's drama of "The Lorgaire," the only new play of the month, is a passable sketch of Irish life. It is much more ingeniously devised than any of his previous efforts in this line, and since it was first put upon the stage has been much improved, many offensive lines being eliminated. Adolph Müller's new comic opera, "The King's Fool," was first witnessed by an American audience in Chicago at the Columbia
  • 72. Theatre on Christmas Eve. Its scene is laid at the court of Pampeluna, and the plot is the development of a conspiracy to secure the succession to the throne, the rightful heir being brought up as a girl, the Salic law forbidding the accession of females. The king's fool discovers the imposition, the young prince regains his throne, and the conspirators are punished. A very enjoyable selection of pieces has been put on the boards at Daly's Theatre, including "The Lottery of Love," "Needles and Pins," "She Would and She Wouldn't," and "Rehearsing a Tragedy." Ada Rehan scored her usual successes. Daly's Theatre is one where the spectator is always sure of a pleasant evening's entertainment. At the Standard "Miss Esmeralda" replaced "Monte Cristo, Jr." The new play was in every way brighter and wittier, and offered more opportunities to the talents of Nellie Farren and the admirable Gaiety Company. Margaret Mather in her repertoire produced at Niblo's Garden shows steady improvement. She makes a lovely Juliet, but in the difficult part of Peg Woffington she is a failure. The "Yeomen of the Guard" is withdrawn from the Casino, not from any lack of popular favor, but because Manager Aronson has been obliged by a contract to restore "Nadjy" to the stage. Herr Junkermann has been giving several very creditable presentations at the new Amberg Theatre, to the delight of our German citizens. Most admirable, yet most difficult and incomplete, was the first production in America of Wagner's "Rheingold" at the Metropolitan Opera House early in January. The stage machinery was very complicated, and the illusions were perfect. As the curtain rose the depths of the Rhine waters appeared to fill the scene, the sun's struggling rays caused the precious gold to gleam; and the three Rhine maidens appointed by Wotan to watch it were seen gracefully swimming about the treasure. From this novel opening to the close, when the gods cross the rainbow bridge that leads to Walhalla, the scenery was a marvel of spectacular effect, but it did not rise to the excellence of the displays at the Bayreuth festivals. The orchestra was in best form, and the singing was the best that has been
  • 73. presented this season—much better, for instance, than in the previous performance of "Siegfried," where Herr Alvary's voice showed signs of wear, and Emil Fischer actually became hoarse before the close. "Faust," "The Huguenots," "L'Africaine," and "Fidelio" were among the musical triumphs of the Metropolitan. Handel's "Messiah" was beautifully given at the same theatre by the Oratorio Society, with the Symphony Society's orchestra, under the direction of Walter Damrosch; while concerts by the Boston Symphony orchestra, by Theodore Thomas, and by Anton Seidl complete the list of delightful musical entertainments of the season.
  • 74. REVIEWS. The Cloven Hoof under Petticoats: The Quick or the Dead; Eros; Miss Middleton's Lovers.—The characteristic American novel of the day might be described as an episode clothed in epigram. It is commonly little more than an incident, slight as to plot, startling in contrasts of light and shade, and too often avowedly immoral in tone—a fragment of canvas, with ragged edges, cut at random from a picture by Gérôme, with figures questionably suggestive, and volcanic in color. It affects a myopic realism in details, not seldom of the sort which, with non-committal suavity, we have agreed to call "improper." It is nothing if not erotic. It deals with humanity from the anatomist's standpoint, and describes, with insistence and reiteration, the physical attributes of its characters, leaving the spiritual to be inferred from their somewhat indefinite actions, and that sort of mental sauntering which is termed analysis, for want of a better name. It sets its women before you in the language of the slave-market. It leaves no doubt in your mind that they are female— female to a fault. "You could not help feeling in her presence that she was a woman; the atmosphere was redolent with her. You never so much as thought of her as a human being, a sentient, reasoning personage like yourself. She was born to be a woman solely, and she fulfilled her destiny." "She was sensuous and voluptuous. You received from her a powerful impression of sex." "She was a naked goddess—a pagan goddess, and there was no help for it." Realistic this may indeed be, but it is hardly chivalrous, or consistent with that respect which well-bred and sound-hearted men feel, or, for the convenience of social intercourse, affect to feel toward that half of human nature to which the mothers, sisters, and wives of the race belong. A woman must be philosophical indeed who can accept as a flattering testimony to her personal graces such a phrase as "She is the most appetizing thing I have seen." To be regarded in the light
  • 75. of a veal cutlet may possess the charm of gastronomic reminiscence, but as a metaphor it is scarcely poetic. In reading this class of fiction one is constrained to wonder what these ingenious weavers of verbal tapestries would have done for plot and incident—such as they are—had the Seventh Commandment been eliminated from the Tables of the Law. It is a never-failing well-spring, a Fortunatus' pocket, a theme more rich in variations than the Carnival of Venice; and it is amazing as well as instructive to the uninitiated to discover in how many original and striking ways a wife may be unfaithful to her husband, and what startling and dramatic situations may be evolved out of the indiscretions of a too confiding society-girl. But even the unmentionable has limits: the glacial smile of the nimblest ballet- dancer may lose somewhat of its fascination in the course of time; and in the overheated atmosphere of the "passionate" novel may lurk the faintest intimations of a yawn. The fact is, this multiform, many-worded element in current fiction is not true passion at all. It is a theatrical presentation, often well set and brilliantly costumed; but too frequently you see the paint and hear the prompter calling forgotten cues from the wings. It is keen, witty, cynical; but it is not real. It is daring, flippantly defiant, paroxysmal, and redundant in explosive adjectives; but it is not true to nature. It is as different from the genuine, living human emotion as the impetuous, fervid, and unpremeditated love-making of a youth is from the cold-blooded, carefully-rounded, and artificial gallantries of an aged suitor. Real passion is always poetic; there is a delicacy in its very vehemence, and if reprehensible from the moralist's point of view, it is never contemptible. Simulated passion, on the other hand, is always coarse and undignified—even when, as in the case with many of these novels, expressed in graceful and smoothly-flowing sentences; often absurd and flavored with covert cynicism, as if it despised itself and its object. Actual passion is almost entirely wanting in American fiction. The purer school of James and Howells makes no pretence of it,—ignoring its existence
  • 76. in human nature, as if men and women were sentient shapes of ice, —and wisely, too; for though the lack of it in romance is a fatal defect, it is better than a poor imitation. Nathaniel Hawthorne, that isolated giant, drew from the mysterious depths of his own great soul almost the only example of true passion in the literature of this country. "The Scarlet Letter" towers aloft like the Olympian Jove among terra-cotta statuettes, perhaps the noblest work of fiction ever written. Here is passion, almost awful in its intensity; suppressed, confined; struggling like a chained Titan, and at length breaking loose and overwhelming itself beneath its own agony and despair—passion, beautiful with youth and hope, star-eyed, crowned with amaranth and clad in blood-red garments; led onward by his dark brothers, Sin and Death, in swift tumultuous flight, toward his unknown goal in the land of eternal shadows. Compared with this lordly poem, the erotic novel of the day, with its prurient platitudes, is as a satyr to Hyperion. Putting aside all question of the moral law in the relation of the sexes, is there not something foolishly undignified in these gasping, gurgling adjectives? "Soul-scorching, flesh-melting flame of his eyes." "Flammeous breath, sweeping her cheek, stirred her nature with a fierce, hungerous yearning." "Ignescent passion." "Gloating upon her hungerly." "Gives her whole body a comprehensive voluptuous twist." "All entangled in her sweet sinuous embrace." "Languorously inviting."—But we pause upon the verge of the unquotable, daunted, stifled, in this mephitic atmosphere. This is called Realism!—this affected posturing, at which good-taste veils the face to hide the smile of contempt or the blush of common decency—these ale-house stories transplanted to the drawing-room! Is there—is there nothing in that love, whose very name lingers upon the lips like a song—that love which has inspired all poetry, all romance from the beginning of time; which has thrown down embattled walls, taken strong cities, changed the boundaries of empires, marshalled armed thousands upon memorable fields of blood; which in every age has nerved men to great deeds and
  • 77. rewarded them for great sacrifices; the sunrise hope of youth, the evening meditation of the old, the spirit of home, the tender light which gleams about the hearth-stone, the glory of the world;—is there nothing, then, in this but the blind impulse which draws animal to animal—which attracts the groping inhabitants of the mire and the shapeless swimming lumps of the sea? If it be so, then thrice sacred is that art which has power to throw a mist of glamour about this hideous reality, and make it seem beautiful to our eyes! Far better the divine lie than such truth! But it is not true: for real love, even though it pass the pale of the law, and real passion, though it tempt to sin, have about them always an inexpugnable dignity; and if condemned, it is not with laughter or disgust. The erotic in American fiction is a recent and exotic growth, not native to the soil. It is therefore unhealthy and unwholesome. It is out of place in this cold northern air. In its own climate it is a gaudy flower; in this temperate zone it is a poisonous, spotted lily, rank of smell and blistering to the touch. The licentiousness of Théophile Gautier is elevated by the power of his transcendent genius to the plane of true art. In America it sinks into a denizen of the gutter. A remarkable feature of this noxious development is the prominent part taken in it by women. It is somewhat startling to find upon the title-page of a work whose cold, deliberate immorality and cynical disregard of all social decency have set the teeth on edge, the name of a woman as the author. We are so accustomed to associate modesty of demeanor, delicacy of thought and word, and purity of life with woman, that a certain set of adjectives, expressive of virtue and morality, have come to include the idea of femininity in their signification. It is certainly surprising, if not repellent, to find women the most industrious laborers in the work of tearing down the structure of honor and respect for their sex, which has so long been regarded as the basis of social existence. If this breaking of the holy images be but another manifestation of the revolt of women against the too narrow limits of ancient prejudice, it is only additional proof that misguided revolution easily becomes mere anarchy. While the
  • 78. dispensation which would confine women to the nursery and kitchen, and exclude them from broader fields of action, is happily a dead letter, it is quite certain that no condition of civilization, however liberal, will ever justify loose principles or lax manners, or what is almost as reprehensible and much more despicable, the cynicism which sneers at virtue while it prudently keeps its own skirts unsoiled. But it is probable that the women who write this kind of fiction are misled by vanity, rather than actuated by evil impulses. They imagine that in thus throwing off all restraint they are giving evidence of originality of thought and force of character; whereas they are, in fact, courting unworthy suspicion and winning only that sort of applause which is thinly veiled contempt. In America social licentiousness is not inherent as a national characteristic, nor inherited from a profligate ancestry. Whatever his practice may be, the ordinary American is theoretically moral. He recognizes moral turpitude, at least to the extent of dreading exposure of his own backslidings. If he break the law, he nevertheless insists upon the sanctity of the law. In a word, the social atmosphere is pure and wholesome, though perhaps a little chilly; and if anyone happens to be the proprietor of a nuisance, he is very careful to keep it well concealed from his neighbors, and neutralize the evil odor with lavish sprinklings of perfumery. With us Licentiousness is not a gayly-clad reveller, a familiar figure at feasts and pleasure parties, taking his share in the festivities, dancing, laughing, and frisking as bravely as any. He is not a jovial Bohemian, of too free life perhaps, but not half a bad fellow—a careless, reckless, roaring blade. On the contrary, he is a dark, shadowy, saturnine personage: a loiterer in lonely places, a lover of the night, skulking around corners and hiding his face in a ready mask. He dreads the law, for he knows that if detected his companions of yesterday will bear witness against him to-day, and lend their aid to set him in the stocks, to be jeered at by all the world. He is thin-blooded and pale; he shudders at the sound of his own footsteps, and shrinks from his own shadow. He knows no
  • 79. songs in praise of Gillian and the wine-cup, and if he did he would never dare sing them. He dresses in the seedy remains of a once respectable suit; he is an outcast, a beggar, a vagabond, down at the heels and owned by nobody. Altogether, he is as miserable and forlorn a wretch as one would care to see, and his alter ego is hypocrisy. For this reason the licentious in American literature is and must be cold, artificial, and repugnant. The erotic becomes mere bald immorality, without grace, gayety, color, or warmth to lend it dignity or render it tolerable. In the opulent, fervid period of the Renaissance, art was born of passion and inspired by it to greatness. The erotic was a legitimate element of all works of the imagination, because it was a part of the social life of the day, and because, being genuine, it could be made beautiful. When, after the Revolution in England and the spread of Calvinism on the Continent, the minds and manners of men were brought under closer restraint, licentiousness in art began to be no longer natural and spontaneous, and therefore no longer legitimate, until in the last century it degenerated into simple indecency. When the erotic ceased to be quite as much a matter of course, in fiction or poetry, as hatred, jealousy, or revenge, and the reader learned to pass it over with a frown or pick it out with a relish, according to his natural disgust of or morbid craving for the impure, it became a blemish. It was no longer real, but an indecent imitation. Compare "Romeo and Juliet," that divine poem of passion, with the abominations of Waters and Rochester, popular in their day, but now happily forgotten, or even Wycherly, not yet quite forgotten, and mark how wide the difference between the true and the false, the natural and the unnatural. To-day, in America at least, the physical is subordinate to the spiritual. The mind is master, and the body in its bondage, if not enfeebled, has at least become trained to passive obedience. All impulses are submitted to the severe scrutiny of reason. Categories of right and wrong, or perhaps the politic and the impolitic, are strictly adhered to. Caution is largely in the ascendant. The world's
  • 80. opinion is an ever-present restraining element. All these are results, or at any rate concomitants of a loftier civilization. A society guided by moral and intellectual forces is unquestionably upon higher ground than one dominated by the physical. The world is, moreover, a more comfortable place to live in than it used to be when, on account of the color of the feather in one's hat, one must unsheathe and go at it, hammer and tongs, to save one's skin. Passion does still exist in the human heart, but it is restrained and modified by the necessities and conditions of the social life of the day. To be a fit element of fiction it must be depicted in its nineteenth-century guise—in other words, decently. To be a truthful picture it can be depicted in no other way. To exhibit it posturing, writhing, and gasping in mere hysteria is to lower it beneath the standard of wholesome and worthy art. License without love, and immorality without passion, are as unpardonable in a novel as they are in human nature. Political Oratory of Emery A. Storrs, by Isaac E. Adams (Belford, Clarke & Co.).—The compiler of Mr. Storrs's political speeches begins his introductory chapter with some questionable generalizations which are belittling and somewhat unjust to the large class of true orators to which his hero belongs. He says: "Few examples of political oratory have been embalmed in literature. Men, too, remembered for oratorical power are easily reckoned, and tower conspicuously along the shores of time. There was once a Demosthenes, once a Cicero, once a Burke. The time will come when, looking back upon the centuries of American history, it will be said there was, also, once a Webster and once a Lincoln." We must be permitted to observe that the line cannot be clearly drawn between political and other oratory. In a broad sense, all the great orators known to history have been political orators, because they gained their fame chiefly in discussing the great and absorbing public questions of their day.
  • 81. To these belongs Emery A. Storrs. Let a few extracts from this volume of speeches suffice to show the style of his oratory. At Chicago, in the darkest hours of our civil war, he said: "I have no doubt but that this, the most wicked rebellion that ever blackened the annals of history, will be ground to powder. I have no doubt but that our national integrity will be preserved. I have no doubt but that the union of these States will be restored, and that the nation will emerge from the fiery trial through which it has passed, brighter and better and stronger than it has ever been before. It would be impossible, however, that a conflict mighty as that from which we are now, I trust, emerging should not leave its deep and permanent impress upon our future national character. It will give tone to our politics, our literature, and our feelings as a people, for ages to come." At Cleveland, in the campaign of 1880, he said: "Have you seen any trouble with the pillars of the government? The trouble was not with the pillars—they did not rock; the trouble was with the gentlemen who were looking at the pillars of the government. They were like the gentleman who had been attending a lecture on astronomy. Going home loaded with a great deal of Democratic logic, with a step weary and uncertain, with the earth revolving a great many times upon its axis, he affectionately clasped a lamp-post and said, 'Old Galileo was right about it: the world does move.'" The logic of Mr. Storrs's speeches on war topics, which were immensely popular, is embraced in the single sentence: "I think there can be nothing more suicidal than to intrust into the hands of these men, who sought the destruction of our national life, the direction of our national interests." Hence the convenient 300-page volume under review will be valuable to political speakers and writers who want their party zeal warmed up by the earnest appeals of an impassioned, conscientious, and clear-minded orator. The diction of Mr. Storrs is admirable, his language is almost always felicitous, and in his logic there is a happy blending of grace and force. If his range was not wide, he was
  • 82. always able to concentrate learning and ability enough on any given occasion to show a masterful oratorical power over immense masses of men.
  • 83. A STORM ASHORE.[5] By James H. Connelly. I. WHERE THE DEED WAS DONE. Three quarters of a century ago, when Sag Harbor was an important whaling port, and before railroads were even dreamed of on that remote part of Long Island, there were dotted along the eastern shore only a few quaint little villages, already old, with a small population scattered in their vicinity, consisting almost entirely of a hardy race, who, though professedly cultivators of the soil, in reality drew most of their subsistence from arduous and often perilous toil upon the sea. Among the curiously inscribed tombstones in the graveyards, where even then six generations were lying, were not at all unfrequent those that bore the legend "killed by a whale." Of the younger men in the community, there were few who did not aspire to go abroad as whalers, and their elders, though settled agriculturists nominally, or even petty tradesmen, had generally "been a-whaling," loved to spin yarns about their cruises, and were still more than semi-nautical in speech, manners, and industries. They naturally spoke of "the bow" of a horse, or his "port-quarter," as occasion might require; belonged to shore whaling companies; fished for the New York market to a limited extent, and perhaps did some smuggling; as shore-living people, in those days, generally seemed to think they had an inherent right to. In their little "sitting- rooms" were many curious and interesting things, brought from far distant lands, such as broad branches of fan coral, stuffed birds of brilliant plumage, strange shells and sperm whales' teeth adorned
  • 84. with queer rude pictures scratched upon them by sailors whose thoughts of loved ones at home had prompted them to such artistic endeavor. Between the villages were long reaches of woodland, or perhaps it would be more correct to say thicket--broken here and there, where the sandy soil seemed to give most promise, by tilled fields. Fierce gales, through the long hard winter months, dealt cruelly with the scrubby cedars and knotty little oaks in those woods, gnarling their boughs, twisting their trunks, and stunting their growth, so that not all the genial breath of spring, nor the ardent summer's sun could quite repair the damage wrought them in the season of ice and storm. But the hardy trees stood close together, as if seeking support and consolation from each other in their hours of trial, when they creaked and ground complaint to one another; so close that their interlaced foliage kept always damp the leaf-strewn ground beneath, where the fragrant trailing arbutus bloomed in earliest spring, and the tangled whortleberry bushes later bore their clusters of bluish-purple fruit. Here and there the dwarfed forest sloped gently down to broad expanses of salt meadow, where snipe and plover found their favorite feeding grounds among the rank rushes and long grass, or the soft marshy slime, except when the full moon tides came rushing through the little inlets between the white round sand dunes on the beach and, whelming the lowland, snatched brown-leaf trophies from the very edges of the wood. On the knolls between these meadows were favorite places for the location of the homes of the earlier settlers, among whom were the Van Deusts. The Van Deust homestead was one of the oldest dwellings on that portion of the island, and those who at this time inhabited it were the direct descendants of other Van Deusts, whose remote existence and remarkable longevity were alike attested by the quaintly graven tombstones in the ancient graveyard of the village, a mile away. It was a rambling one-story house, built of small logs covered with boards now warped and rusty from age, but both roomy and comfortable as well as picturesque. Those by whom it was erected
  • 85. loved better the sea than the land, for they had not only sought out this, the most commanding site they could obtain for its location, but had turned its back upon the forest and the lane, and reared its broad porch upon the side facing the ocean. Here, in the ample shade, the two old bachelor brothers, its present occupants, inheriting as well the feeling as the property of their ancestors, loved to linger. The ceaseless roar of the waves was in their ears a wild tumultuous music, and their eyes were never weary of the ever- changing beauty and glory of the world of billows, blushing with the dawn, laughing with the noon, and frowning beneath storm and night. Three broad and rugged elm trees shaded the porch, and one gable of the house was rasped by the boughs of the nearest tree of a thickly grown and badly cared for little orchard. Bats and swallows flitted undisturbed in the summer evenings to and from the low loft of the old homestead, through its various chinks and refts; native song-birds build their nests and reared their young under the eaves, and in the swinging branches of the venerable elms; bees buzzed among the thick honeysuckle, and clematis vines that twined about the pillar of the porch, and threw their long sprays in flowery festoons between; and when the busy hum of those industrious little toilers ceased at nightfall, the crickets' cheery chirp, from among the rough stones of the old-fashioned fireplace within, took up the refrain of insect melody. Neither insect, bird, nor beast feared the two kindly old men who inhabited that home. One of the brothers loved all living things, and was at peace with all, and the other was like unto him, with the sole exception that he liked not women, nor was willing to be at peace with them. Yet he had never been married! Peter, the elder by a couple of years, was the woman hater, and to such an extent did he carry his antipathy toward the sex, that he would tolerate no other female servant about the house than old black Betsy, who was the daughter of a couple of slaves his grandfather had owned, and who thoroughly considered herself one of the family, as indeed her indulgent masters regarded her. The three old people occupied the house alone. Brother Jacob once
  • 86. hinted to Peter that perhaps it might be as well to get a young woman to assist old Betsy in her work, and his so doing brought on what was more like a quarrel between him and Peter than anything that had disturbed the monotony of their uneventful lives up to that time. A compromise was finally effected, by virtue of which a neighbor was engaged to come over for a couple of hours daily to do such chores about the house as the brothers felt beyond their strength, and to bring his wife along on Tuesdays to do the week's washing and scrubbing. But on Tuesdays Peter always went a- fishing, regardless of the weather, and was gone all day, so avoiding sight of the neighbor's wife. Whatever the secret cause for his bitter and contemptuous aversion to women may have been, he kept it to himself. That they were fair to look upon, he denied not. "But," said he, "they are wrecker lights, and the truer and better a man is, the brighter they shine to lure him to the breakers. And look at yourself, Jacob," he would add, when his brother ventured to mildly expostulate against the vigor of his denunciations of the sex; whereupon Jacob would turn away with a sigh, and the discussion would be at an end. Back of the house a narrow lane, bordered by a neglected garden and a cornfield beyond, led out to the distant highway. The Van Deust brothers were not poor, as the humble style of their home might seem to indicate; indeed they had the reputation, in all the country around, of being wealthy, and were, at least, well off. The neglect and indifference of age in its owners was the sole cause that the surroundings of the old homestead, which might easily have been made charming, presented such a picture of disorder and decay. Up the little lane, at a very early hour one bright summer morning, two men might have been seen, driving in a light gig, approaching the Van Deust mansion. One of them was a stout, ruddy-faced gentleman, of fifty, or thereabouts, known to everybody in the county as Squire Bodley. His companion, who held the reins, was a handsome young fellow of twenty-four or twenty-five years, rustic in
  • 87. personal appearance and garb, with a good frank open countenance that bore a pleasing expression of intelligence and good nature. "Of course it's only a form, my going to be your security," said the older man, as they jogged along, "for the Van Deusts know you as well as I do, and knew your father, Dave Pawlett, before you, and a good man he was. But still, Lem, I don't know any young fellow in all the country round about that I'd take more pleasure in serving, even in a matter of form, than you." "Thank you, sir," replied the young man warmly, with a grateful flush upon his sun-burnt cheeks. "It's very kind of you, I'm sure, and I can't tell you how much I feel it so. You know I want the lease of that lower farm, but you don't know how almightily much I want it; and nobody does but me and—one other person, perhaps." "Aha!" responded the Squire, with a chuckle, "I can make a guess about who the other person is. And some day you and that other person will be coming to me for a little business in my line, I reckon, —a sort of mutual life lease, eh?" "Well, maybe so, Squire. I hope so," answered Lem, confusedly, and with a little deeper flush, "But here we are at the gate. Wait a moment, while I jibe the bow wheels and make the horse fast." As he spoke, he jumped lightly out of the vehicle, turned the horse a little to one side, so as to make the descent of his companion more convenient, and, after hitching the reins to a fence-post, accompanied the Squire to the door of the house. There was no sound, or sign, as yet, of any of the inmates of the old homestead being astir. "Well, they must be late risers here," soliloquized the Squire, as Lem rapped and called at the door. At the end of a few minutes, a voice answered indistinctly from within: "Who's there? What d'ye want?" And almost immediately after, the shutters on the window of a little extension of the house,
  • 88. at the end farthest from the orchard, were pushed open, and the head of an aged black woman appeared with the echoing query, "Who dah? Wha' dy'e wan'?" "It's me—Squire Bodley," responded that gentleman, answering the first inquirer. Presently the door opened and Peter Van Deust appeared in it; a weazened, thin little man, with a fringe of gray hair surrounding a big white bald place on the top of his head, with a well-formed nose and eyes still bright enough to suggest that he had been a good- looking young fellow in his day; with lips that quivered, and long lean fingers that trembled with the weakness of old age; but, withal, a pleasant smile and a cheery ring, even yet, in his cracked old voice. "Why, Squire!" he exclaimed, as he threw open the door, "I'm real glad to see you. And Lem! You, too? Well, this is a pleasant surprise- party for us early in the morning!" "It's not so very early, Peter," answered the Squire. "It is almost seven o'clock." "Is that so? Well, I declare! I wonder why Jacob isn't up. He's mostly an early riser, and as he's the boy amongst us, why we old folks— Betsy and me—rely on him to wake us up in the mornings. Old people, you know, get back to being like babies again for wanting their good sleep. But Jacob has overslept himself this morning, sure. I'll soon roust him out, though." As he spoke he went to a closed door at one side of the central sitting-room, which was flanked by the separate apartments of the brothers, and pounding upon it with his bony knuckles, called: "Come, Jacob, bounce out, boy! You're late! It's breakfast time, and we've got visitors. Get up!" There was no answering sound from within. He waited a moment, then knocked again, shouting: "Hello, Jacob! Jake! I say, get up!
  • 89. What' the matter with you?" Still there was no response. The three men waiting, held their breath to listen, and a vague sense of uneasiness crept over them. The songs of the blue-birds, and the chirp of the martens; the humming of the bees; the stamping of the horse hitched to the gig, and the clatter old Betsy made in opening her door, were all sharply distinct in the quiet summer morning air; but from the closed room there was no sound whatever. Peter tried the door, but it did not yield. "He's locked his door!" exclaimed the old man, with an intonation of surprise in his voice. "Maybe something has happened to him," suggested Lem. "What could happen to him? He was all right last night; never better in his life. And he's younger than me. But it's queer he should have locked his door. He don't mostly." He continued rapping and shouting "Jacob, wake up!" in a more and more anxious tone. "The key isn't in the keyhole, I guess," he muttered half to himself, fumbling at the lock with a bit of stick he picked up from the floor, "but," stooping down and trying to peer through, "I can't see anything, because it's all dark inside." "Haven't you some other key about the house that will fit the lock?" asked the Squire. "Yes. Mine does, I guess. But I didn't think of it at first. I'll try it." It fitted: the bolt was thrown back, and the door pushed open. The sunshine darted in and fell, broad and clear, upon a still and ghastly thing that laid in the middle of the floor—the corpse of an old man, surrounded by a pool of blood. Peter gave a wild cry of horror, and fell back senseless into the arms of Lem Pawlett, who was close behind him. They laid him on the old hair-cloth sofa in the sitting-room, called Betsy to attend to him, and then passed into the chamber he had opened.
  • 90. Murder had been done. Jacob Van Deust's skull had been beaten in by some heavy instrument. One terrible crushing blow had mashed in his left temple, and let out his little weak old life; but, as if for very lust of killing the assassin had struck again and again, and the skull was fractured in several places. The old man, it appeared, had risen from his bed to meet his murderer, and had been struck down before he could utter a cry of alarm. The window curtains were down, so that the room was as yet only lighted from the door; but when those in front were opened, and a flood of sunlight poured in, there were no evidences apparent that there had been any struggle between the slayer and his victim, nor were there at once visible any indications that robbery, the only cause readily conceivable for the brutal murder of such an inoffensive old man, had been the purpose instigating the crime. The contents of the bureau drawers were much tumbled and disordered, but it was presumable that they were so usually, through the careless habits of the occupant of the apartment. There were no marks of blood upon anything they contained, but it was evident that the murderer had made some attempt at least to wipe his crimsoned hands upon the old man's shirt after killing him, and that was probably before he searched the bureau, if indeed he had troubled himself to ransack it at all. On one pillow of the bed they found the mark of a bloody hand. Perhaps the assassin was in such haste for plunder that he groped where the old man's head had lain before thinking of his bloody hand. Beyond that nothing appeared to them to show that robbery had been done. But when Peter Van Deust had sufficiently recovered to be able to speak coherently, he said that his brother habitually kept, somewhere in his room, a wallet containing something over three thousand dollars, and a bag of coin; how much he did not know. These were nowhere to be found. Lem Pawlett was hastily dispatched by the Squire, soon after the discovery of the crime, to summon some near neighbors; and as he drove rapidly along the road, shouting to every person he saw —"Jacob Van Deust has been murdered!"—it was but a very little
  • 91. 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