Delphi 7 - Tutorial - Creating a CLX Database Application.pdf

(263 KB) Pobierz
Tutorial: Creating a CLX
Database Application
Borland ®
Delphi 7
for Windows
Borland Software Corporation
100 Enterprise Way, Scotts Valley, CA 95066-3249
www.borland.com
920511087.004.png
 
920511087.005.png 920511087.006.png 920511087.001.png
C OPYRIGHT © 2001–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.
D7-DB-0802
Contents
Creating a CLX database application
Overview of database architecture . . . . . . . . . 1
Creating a new project. . . . . . . . . . . . . . . . 2
Setting up data access components . . . . . . . . 3
Setting up the database connection. . . . . . . 3
Setting up the unidirectional dataset . . . . . . 5
Setting up the provider, client dataset,
and data source . . . . . . . . . . . . . . . . . 5
Designing the user interface . . . . . . . . . . . . 6
Creating the grid and navigation bar . . . . . 6
Adding support for a menu . . . . . . . . . . . 8
Adding a menu . . . . . . . . . . . . . . . . . . 10
Adding a button . . . . . . . . . . . . . . . . . 11
Displaying a title and an image . . . . . . . . . . 12
Writing an event handler. . . . . . . . . . . . . . 13
Writing the Update Now! command
event handler. . . . . . . . . . . . . . . . . . 13
Writing the Exit command event handler . . 14
Writing the FormClose event handler. . . . . 15
Index
iii
920511087.002.png
 
iv
1
Creating a CLX database application
Chapter1
This tutorial guides you through the creation of a cross-platform application that lets
you view and update a sample employee database. Cross-platform applications use
CLX, the Borland Component Library for Cross-Platform. Designed to compile and
run on different platforms, CLX applications require a minimum of changes between
Windows and Linux ports.
This tutorial assumes you are familiar with Windows and have read the introduction
to Delphi programming and the IDE in the Quick Start .
This tutorial requires the Professional or Enterprise editions of Delphi, which include
database components. You must also have InterBase installed to successfully
complete this tutorial.
Note
Overview of database architecture
The architecture of a database application may seem complicated at first, but the use
of multiple components simplifies the development and maintenance of actual
database applications.
Database applications include three main parts: the user interface, a set of data access
components, and the database itself. In this tutorial, you will create a dbExpress
database application. Other database applications have a similar architecture.
The user interface includes data-aware controls such as a grid so that users can edit
and post data to the database. The data access components include the data source,
the client dataset, the data provider, a unidirectional dataset, and a connection
component. The data source acts as a conduit between the user interface and a client
dataset. The client dataset is the heart of the application because it contains a set of
records from the underlying database which are buffered in memory. The provider
transfers the data between the client dataset and the unidirectional dataset, which
1
Creating a CLX database application
920511087.003.png
Zgłoś jeśli naruszono regulamin