在好例子网,分享、交流、成长!
您当前所在位置:首页Pascal 开发实例Delphi网络编程 → Delphi7开发指南(英文版)

Delphi7开发指南(英文版)

Delphi网络编程

下载此实例
  • 开发语言:Pascal
  • 实例大小:12.74M
  • 下载次数:12
  • 浏览次数:139
  • 发布时间:2019-11-05
  • 实例类别:Delphi网络编程
  • 发 布 人:逍遥悠
  • 文件格式:.rar
  • 所需积分:2
 相关标签: delphi 开发指南 开发

实例介绍

【实例简介】

【实例截图】

from clipboard



【核心代码】

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
v
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
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-8
Service name properties . . . . . . . . . 8-9
Debugging service applications . . . . . 8-10
Creating packages and DLLs . . . . . . . . . . 8-11
When to use packages and DLLs . . . . . . 8-11
Writing database applications . . . . . . . . . . 8-12
Distributing database applications . . . . . 8-13
Creating Web server applications . . . . . . . . 8-13
Creating Web Broker applications . . . . . . 8-14
Creating WebSnap applications . . . . . . . 8-15
Creating Web Services applications . . . . . 8-15
Writing applications using COM . . . . . . . . 8-16
Using COM and DCOM . . . . . . . . . . . 8-16
Using MTS and COM  . . . . . . . . . . . . 8-16
Using data modules . . . . . . . . . . . . . . . 8-17
Creating and editing standard data
modules. . . . . . . . . . . . . . . . . . . . 8-17
Naming a data module and
its unit file . . . . . . . . . . . . . . . . 8-18
Placing and naming components . . . . 8-19
Using component properties and
events in a data module . . . . . . . . 8-19
Creating business rules in a
data module . . . . . . . . . . . . . . . 8-20
vi
Accessing a data module from a form . . . 8-20
Adding a remote data module to an
application server project . . . . . . . . . 8-21
Using the Object Repository . . . . . . . . . . 8-21
Sharing items within a project . . . . . . . 8-21
Adding items to the Object
Repository . . . . . . . . . . . . . . . . . . 8-22
Sharing objects in a team
environment. . . . . . . . . . . . . . . . . 8-22
Using an Object Repository item in
a project . . . . . . . . . . . . . . . . . . . 8-22
Copying an item . . . . . . . . . . . . . 8-22
Inheriting an item . . . . . . . . . . . . 8-23
Using an item . . . . . . . . . . . . . . 8-23
Using project templates . . . . . . . . . . . 8-23
Modifying shared items . . . . . . . . . . . 8-23
Specifying a default project, new form,
and main form . . . . . . . . . . . . . . . 8-24
Enabling Help in applications . . . . . . . . . 8-24
Help system interfaces. . . . . . . . . . . . 8-25
Implementing ICustomHelpViewer . . . . 8-25
Communicating with the Help
Manager . . . . . . . . . . . . . . . . . . . 8-26
Asking the Help Manager for
information . . . . . . . . . . . . . . . . . 8-26
Displaying keyword-based Help . . . . . . 8-27
Displaying tables of contents . . . . . . . . 8-28
Implementing IExtendedHelpViewer . . . 8-28
Implementing IHelpSelector . . . . . . . . 8-29
Registering Help system objects . . . . . . 8-30
Registering Help viewers . . . . . . . . 8-30
Registering Help selectors . . . . . . . 8-30
Using Help in a VCL application. . . . . . . . 8-31
How TApplication processes
VCL Help . . . . . . . . . . . . . . . . . . 8-31
How VCL controls process Help . . . . . . 8-31
Using Help in a CLX application. . . . . . . . 8-32
How TApplication processes
CLX Help . . . . . . . . . . . . . . . . . . 8-32
How CLX controls process Help . . . . . . 8-32
Calling a Help system directly . . . . . . . . . 8-33
Using IHelpSystem . . . . . . . . . . . . . . . 8-33
Customizing the IDE Help system . . . . . . . 8-34
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
vii
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
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-1
Memo and rich edit controls . . . . . . 10-2
Text viewing controls . . . . . . . . . . . . . 10-3
Labels . . . . . . . . . . . . . . . . . . . . . . 10-3
Specialized input controls . . . . . . . . . . . . 10-4
Scroll bars . . . . . . . . . . . . . . . . . . . 10-4
Track bars. . . . . . . . . . . . . . . . . . . . 10-5
Up-down controls . . . . . . . . . . . . . . . 10-5
Spin edit controls (CLX only) . . . . . . . . 10-5
Hot key controls (VCL only) . . . . . . . . . 10-6
Splitter controls . . . . . . . . . . . . . . . . 10-6
viii
Buttons and similar controls . . . . . . . . . . 10-6
Button controls . . . . . . . . . . . . . . . . 10-7
Bitmap buttons . . . . . . . . . . . . . . . . 10-7
Speed buttons. . . . . . . . . . . . . . . . . 10-8
Check boxes. . . . . . . . . . . . . . . . . . 10-8
Radio buttons . . . . . . . . . . . . . . . . . 10-8
Toolbars . . . . . . . . . . . . . . . . . . . . 10-9
Cool bars (VCL only). . . . . . . . . . . . . 10-9
List controls. . . . . . . . . . . . . . . . . . . . 10-9
List boxes and check-list boxes . . . . . . . 10-10
Combo boxes . . . . . . . . . . . . . . . . . 10-11
Tree views . . . . . . . . . . . . . . . . . . . 10-11
List views . . . . . . . . . . . . . . . . . . . 10-12
Icon views (CLX only) . . . . . . . . . . . . 10-12
Date-time pickers and month
calendars. . . . . . . . . . . . . . . . . . . 10-12
Grouping controls . . . . . . . . . . . . . . . . 10-12
Group boxes and radio groups . . . . . . . 10-13
Panels . . . . . . . . . . . . . . . . . . . . . 10-13
Scroll boxes . . . . . . . . . . . . . . . . . . 10-13
Tab controls . . . . . . . . . . . . . . . . . . 10-14
Page controls . . . . . . . . . . . . . . . . . 10-14
Header controls. . . . . . . . . . . . . . . . 10-14
Display controls . . . . . . . . . . . . . . . . . 10-15
Status bars. . . . . . . . . . . . . . . . . . . 10-15
Progress bars . . . . . . . . . . . . . . . . . 10-15
Help and hint properties . . . . . . . . . . 10-16
Grids. . . . . . . . . . . . . . . . . . . . . . . . 10-16
Draw grids . . . . . . . . . . . . . . . . . . 10-16
String grids . . . . . . . . . . . . . . . . . . 10-16
Value list editors (VCL only) . . . . . . . . . . 10-17
Graphic controls . . . . . . . . . . . . . . . . . 10-18
Images . . . . . . . . . . . . . . . . . . . . . 10-18
Shapes . . . . . . . . . . . . . . . . . . . . . 10-18
Bevels . . . . . . . . . . . . . . . . . . . . . 10-18
Paint boxes . . . . . . . . . . . . . . . . . . 10-19
Animation control . . . . . . . . . . . . . . 10-19
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
ix
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
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
x
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
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
xi
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
Deploying database applications. . . . . . . . 18-6
Deploying dbExpress database
applications . . . . . . . . . . . . . . . . . 18-7
Deploying BDE applications . . . . . . . . 18-8
Borland Database Engine . . . . . . . . 18-8
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
xii
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
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
xiii
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
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
xiv
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
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
xv
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
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
xvi
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
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
xvii
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
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
xviii
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
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
xix
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
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
xx
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
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
xxi
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
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 WSDL 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
Handling scalar-type headers . . . . . 38-17
Communicating the structure of your
headers to other applications . . . . 38-18
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
xxii
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
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
xxiii
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
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
xxiv
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
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
xxv
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

实例下载地址

Delphi7开发指南(英文版)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警