Delphi Developer's Guide
✍ Scribed by Xavier Pacheco, Steve Teixeira
- Publisher
- Sams
- Year
- 1995
- Tongue
- English
- Leaves
- 950
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
Delphi Developer's Guide provides a solution-oriented approach to application development that uses the visual programming tools in Delphi for implementation. Covers design methodology as well as the software. Shows what the future holds for GUI application development. Explains how visual programming is used in developing the various parts of an application.
✦ Table of Contents
Title page
Overview
Contents
Foreword
Acknowledgments
Introduction
I. Getting started
I.1. Windows Programming in Delphi
A Little History
What Is Delphi?
The Delphi IDE
The Code Generator
Creating a Small Application
What's So Great About Events, Anyway?
Contract-Free Programming
Turbo Prototyping
Extensible Components
Summary
I.2. Moving to Pascal
Commentary
Variables
Constants
Typed Constants
Operators
Assignment Operator
Comparison Operators
Logical and, or, and not operators
Arithmetic Operators
Bitwise Operators
Increment and Decrement Operators
Types
Strings
Pascal Strings
Null-Terminated Strings
Arrays
User-Defined Types
Records
Objects
Pointers
Typecasting
Testing Conditions
The if statement
Using Case Statements
Looping Constructs
The while Loop
The for Loop
The repeat..until Loop
The Break Procedure
The Continue Procedure
Procedures and Functions
Passing Parameters
Value Parameters
Reference Parameters
Constant Parameters
Scope
Units
The uses Clause
Circular Unit References
Summary
I.3. The Object Pascal Language
What Does Object-Oriented Mean?
Anatomy of an Object
Object-Based Versus Object-Oriented
A New Class Of Objects
The Differences Between Class And Object
PropertiesXXX
Methods
Defining Methods
Method Types
Overriding a Method
Self
Class Visibility Specifiers
TObject: The Mother of Objects
Getting a Handle on Exceptions
Exception Classes
The Exception object
Raising an Exception
Re-raising an Exception
Runtime Type Information
RTTI Methods
RTTI Operators
Summary
I.4. The Visual Component Library (VCL)
Types of Components
TObject
TPersistent
TComponent
TControl
TWinControl
TCustomControl
TGraphicControl
Other Components
The Object Browser
Summary
I.5. Basic Concepts in Delphi—TForms, TScreen, and TApplication
Strange New Life—Forms
Changing a Form's Icon Boxes and Borders
Making Forms Reusable
Saving Your Form as a Template
Adding a Context-Sensitive Help Form to the Template
Setting Default Main and New Form in the Gallery
Adding Forms to the Component Palette
Creating Your Form
Using Your Component
The TScreen Component
TApplication
Summary
I.6. Sprucing Up Forms
Forms Versus Windows and Dialog Boxes
Changing a Forms Appearance Through Its Properties
A Form's Color and Size
Choosing Two- or Three-Dimensional Forms
Setting Fonts for Forms
Adding Menus to a Project
Creating a Main Menu
Creating SpeedBars and Floating Toolbars
Creating Fancy Dialog Boxes
Using TStrings
Adding Tabs to Your Applications
Using Notebooks
Adding Drag-and-Drop Capabilities
Using Hints in Your Applications
Summary
I.7. Using VBX Controls with Delphi
Understanding VBX Controls
Deciding When To Use a VBX
Adding a VBX to the Component Palette
Using VBX Controls in Your Applications
VBX Functions, Objects, and Types
VBX Graphics
VBX Helper Functions
Shipping VBX-Equipped Applications
Summary
I.8. MDI Applications
Creating the MDI Application
Understanding MDI Basics
Using the Child Forms
The Text Editor Form
The Bitmap Viewer
Creating the MDI Frame Form
Adding Menus to MDI Applications
Creating the Menus
Merging the Menus
Working with Child Windows
Creating a Child Edit Form at Runtime
Closing Child Forms
Using Window Commands
Adding a List of Open Documents to the Menu
Using Text Editor Commands
Adding Common Dialog Boxes to Your MDI Application
Opening Files
Saving Your Files with the Text Editor
Using the Font Dialog Box
Using the Print Dialog Boxes
Using the TPrinter Object
Using the TPrintDialog Component
Using the TPrinterSetup Dialog
Printing Bitmaps
Using the Clipboard
Changing Child Styles
Summary
I.9. Understanding Messages
What Is a Message?
Types of Messages
How the Windows Message System Works
Delphi's Message System
Message-Specific Records
Handling Messages
Message Handling: Not Contract-Free
Assigning Message Result Values
TApplication's OnMessage Event
Sending Your Own Messages
Perform()
Send and Post
Non-Standard Messages
Notification Messages
Internal VCL Messages
User-Defined Messages
Messages Within Your Application
Messaging Between Applications
Broadcasting Messages
Anatomy of a Message System: VCL
The Relationship Between Messages and Events
Summary
I.10. GDI and Graphics Programming
Drawing with the Canvas
Using Pens
Using Brushes
Using Fonts
Using Canvas's Drawing Methods
Drawing Lines
Drawing Shapes
Displaying Text with the Canvas
Using Canvas' Pixels
Delphi's Representation of Pictures: TImage
Using GDI Functions
Coordinate Systems and Mapping Modes
Coordinate Systems
Mapping Modes
The Canvas Sample Project
Advanced Fonts
Types of Windows Fonts
Basic Font Elements
A Font's Typeface, Family, and Measurements
GDI Font Categories
Raster Fonts Explained
Vector Fonts Explained
True Type Fonts Explained
Creating Your Own Fonts
Creating the Font
The TLOGFONT Structure
Displaying Font Information
Summary
I.11. Writing Delphi Custom Components
Deciding Whether to Write a Custom Component
Writing Custom Components
Creating a TRunButton
Adding Code to the Skeleton
Developing a Component
Step One: Come Up with an Idea
Step Two: Create a Game Plan
Step Three: Write the Code
Extending the TListBox Component
The Idea and Game Plan
The Code
Creating a Marquee
Analyzing How Your Component Will Work
Writing the Component
Using the Memory Canvas
Using the Paint Method
TMarquee's Timer
Construction Ahead
Creating Events
The Four P's: Private, Protected, Public, and Published
Virtual or Nonvirtual?
Testing the Component
Using the Component
Creating a Component Palette Icon
Summary
I.12. Printing in Delphi
The TPrinter Object
TPrinter.Canvas
Simple Printing
Printing a TMemo Component
Using BeginDoc() and EndDoc()—Printing a Bitmap
Printing a Form
Advanced Printing
Printing a Columnar Report
Aborting the Printing Process
Printing Envelopes
Printing in Abstract
A Step-by-Step Process to Printing
Getting Down to Business
A Simple Print Preview
Summary
I.13. Multimedia Programming with Delphi
Creating a Simple Media Player
Using WAV Files in Your Applications
Playing Video
Showing the First Frame
Using the Display Property
Using the DisplayRect Property
Unnderstanding TMediaPlayer Events
Viewing the Source Code for EasyMM
Examining Device Support
Creating an Audio CD Player
Displaying a Splash Screen
Beginning the CD Player
Updating the CD Player Information
TimeFormat
Time-Conversion Routines
Methods for Updating the CD Player
GetCDTotals()
ShowCurrentTime()
ShowTrackTime()
CD Player Source
Summary
I.14. Sharing Information with the Clipboard and DDE
In the Beginning, There Was the Clipboard
Using the Clipboard with Text
Using the Clipboard with Images
Creating Your Own Clipboard Format
Copying Data to the Clipboard
Pasting Data from the Clipboard
Flexible Applications
Dynamic Data Exchange
COmmunication Among Applications
DDE Services
DDE Topics
DDE Items
Breaking the Ice
Creating a DDE Server Project
Making the Data Available from a DDE Server
Creating a DDE Client Project
Establishing Links with a DDE Server
Connecting Automatically with DDE Using the
ddeAutomatic Connect Mode
Connecting Manually with DDE Using the ddeManual
Connect Mode
Using the TDDEServerConv Component
Poking Data
Executing Macros
Creating the Project
Summary
I.15. Object Linking and Embedding with OLE
OLE Basics
OLE Terminology
What's So Great About OLE?
OLE 1 Versus OLE 2
OLE 2 Behind the Scenes
Component Object Model
Structured Storage
Uniform Data Transfer
TOleContainer
A Small Sample Application
Embedding a new OLE Object
Embedding or Linking an Existing OLE File
A Bigger Sample Application
Preparing for Clipboard Usage
Creating a Child Form
Saving to and Reading from Streams
Using the Clipboard to Copy and Paste
Summary
I.16. Writing Database Applications
The Borland Database Engine
TDataset
Navigating Datasets
Opening a TDataset
Navigating Records
Bookmarks
Navigational Example
Loop Navigation
Fields
Field Names and Numbers
Field Values
Modifying and Adding Data
Refreshing the Dataset
Altered States
Using TTable
Searching
FindKey()
SetKey()..GotoKey()
The Closest Match
Which Index?
Ranges
SetRange()
ApplyRange()
Removing a Range Filter
Search and Range Demo
TTable Events
Creating a Table
TDataSource
Calling the BDE
Deploying Database Applications
Summary
I.17. Working with SQL and the TQuery Component
What Is SQL?
Set-Oriented Versus Record-Oriented Databases
Using the TQuery Component
Static SQL Statements
Dynamic SQL Statements
Using the Params Property
Using the ParamByName Method
Sorting the Data
Using the Format() Function to Create SQL Strings
Using TQuery's DataSource Property
Inserting, Deleting, and Updating Records
Inserting Records
Deleting Records
Updating Records
Joining Multiple Tables
Using Heterogeneous Queries
Creating and Altering Tables
Summary
I.18. Dynamic Link Libraries (DLLs)
What Exactly Is a DLL?
Static Linking Versus Dynamic Linking
Why Use DLLs?
Sharing Code, Resources, and Data
Hiding Implementation
System-Level Routines
Custom Controls
Creating DLLs
Counting Your Pennies (A Simple DLL)
Creating the DLL
Creating an Interface Unit
Making Forms Available from DLLs
Using DLLs in Your Delphi Applications
Implicitly Loading DLLs
Explicitly Loading a DLL
Looking at DLL Initialization and Termination Code
DLL Initialization
DLL Termination
Examining Special DLL Considerations
Exceptions in Exported Functions
Exceptions to Everything!
Using the Borland Database Engine (BDE) in DLLs
Other Considerations
Calling C and C++ DLLs
Calling Convention
Name Mangling
Variable Types
You Make the Call
Summary
I.19. Migrating from Borland Pascal to Delphi
Using the Result Variable
Result: The Codebreaker
Result: Not All Bad
case Statements
Working with PChars
Error Handling
Accessing Files
Porting DOS Code
Knowing Where to Begin
Differences in Porting from Real Mode and Protected Mode
Using Direct Memory Access
Using Absolute Variables
Handling Interrupts
Making Interrupt Calls
Linking in Assembly Modules
Examining Overlays and Memory Issues
Using the $M Directive
Using DOS-Only Functions
Using the Delay() Procedure
Using the Exec() Procedure
Using Halt() and RunError()
Issues Regarding Object Model Versus Class Model
TObject and Object Allocation
The virtual Directive
Streams
Leaving OWL Behind
Porting the User Interface
Porting the Back End
Looking at TList versus TCollection
Summary
I.20. Power Programming: BASM and DPMI
Using BASM with Delphi
How Does BASM Work?
Easy Parameter Access
var Parameters
Using Extended Registers
inline
All-Assembly Procedures
DOS Protected Mode Interface
DPMI Memory Management
More on Selectors
Creating Selectors
Using Precreated Selectors
SelectorInc and Crossing Segment Boundaries
Using TGodzillArray
Interrupts Under DPMI
Executing Supported Interrupts
Executing Unsupported Interrupts
More on DPMI
Summary
I.21. Hard-Core Windows
Understanding the Application Window Procedure
Subclassing
Running Multiple Instances
Preventing Multiple Instances
Sharing Data Between Instances
Using Windows Hooks
Setting the Hook
Using the Hook Function
Using the Unhook Function
Using SendKeys: a JournalPlayback Hook
Deciding Whether To Use a JournalPlayback Hook
Understanding how SendKeys Works
Creating Key Presses
Understanding the Interface Unit
Using SendKeys()
Subclassing Formas
Making Nondirect TForm Descendants Child Windows
Summary
I.22. Testing and Debugging
Common Program Bugs
Using a Class Variable Before It Is Created
Ensuring that Class Instances Are Freed
Using the Uninitialized Pointer
Using Uninitialized PChars
Dereferencing the Nil Pointer
Using the Integrated Debugger
Using Command-Line Parameters
Using Breakpoints
Using Conditional Breakpoints
Executing Code Line by Line
Using the Watch Window
Using the Evaluate and Modify Options
Accessing the Call Stack
Looking at Integrated Debugger Limitations
Looking at the Turbo Debugger Features
The CPU Window
Breakpoints
Breaking
Logging
Executing
Using Group Enable and Disable
Using Turbo Debugger Advanced User API (TDUSER)
Looking at the Information in TTDUserInfoBlock
Looking at Some Sample Uses for TDUSER API
Using Turbo Debugger Video API (TVIDEO)
Summary
II. Real-World Building Blocks
II.23. SysWatcher: A System Monitor
Prototyping the User Interface
Formatting Info Strings
Getting System Information
Determining Free Heap
Getting the OS Version
Getting Processor Information
Getting Windows Directory Information
Getting the DOS Environment
Walking the Module List
Using an Owner-Draw Listbox
Finishing Touches
Summary
II.24. Building an Address Book Application
Defining the Application
Looking at the Feature List
Defining the Data
Creating the Main Form
Connecting the Data-Aware Components
Using the TDBLookupCombo Component
Working with TField's EditMask Property
Additional Components
Adding the Menus to the AddrForm
Getting to the Source
Adding Clipboard Capabilities
Summary
II.25. Creating a Calendar/Scheduler and Alarm Application
Examining the Calendar's Functionality
Looking at the TDDGCaledar Class
Creating the TDDGCalendar
Looking at the Alarm Behavior
Creating Alarm Events
Defining the TOnAlarmEvent
Working with the TINIFile Class
Creating TDDGCalendar
Drawing TDDGCalendar
Using the Main Form
Using the Day Scheduler Form
Using the Set Alarm Form
Using the Remove Alarm Form
Summary
II.26. Building a Phone Dialer/Terminal Application—Serial
Communications
Defining Serial Communications
Serial Communication Considerations
A TurboPower-ful Solution to Windows Serial-Communications
Programming
Installing Async Professional for Delphi
Async Professional for Delphi, Unplugged
The ComPort Component
The TEmulator Component
The TTerminal Component
The TProtocol Component
The TProtocolLog Component
The TProtocolStatus Component
The TModem Component
The TModemDialer Component
The APD Demonstration Project
The Com Port Options Form
The Protocol Options Form
The DownloadDialog Form
The UploadDialog Form
The DialDialog Form
The Main Form
Running Through the Demo
Summary
II.27. Building a File Manager Application
Examining the Feature List
Creating the Necessary Forms
The Main Form
The Child Forms
Prompt Forms
Prompt1Form
Prompt2Form
The Find File Form
The Properties Form
Adding Functionality to the Forms
Creating TStatusBar—A Custom Component
Using the Main Form—TDDGFile Form
Searching for Valid Drives
Using Owner-Draw Comboboxes
Exiting the Application
Adding Functionality to TPrompt1Form
Adding Functionality to TPrompt2Form
Searching for Files Using Recursion
Displaying File Properties and Version Information
Defining the TVerInfoRes Class
Getting File Attribute and Size Information
Setting Up TDriveForm
Executing Other Programs
Copying Files Using Drag and Drop Capabilities
Copying Files Through The Menu
Moving and Renaming Files
Deleting a File
Creating and Removing Directories
Searching for Files
Exiting the Application
Performing the Final Touches
Summary
II.28. Building a Time-Tracker Application
Examining the Feature List
Creating the Tables
Looking at the Required Forms
Creating MainForm
Creating TaskManagerForm
Working TField and Calculated Fields
Creating AddTaskForm and SubTaskDataForm
Creating ClientManForm
Creating ReportForm
Examining MainForm's Functionality
Examining TaskManageForm's Functionality
Examining ClientManForm's Functionality
Examining ReportForm's Functionality
Summary
III. Real-World Applications
III.29. Inventory Manager—Preliminary Design Issues
The Concept
The Data Model
The Database
Creating Domains
Creating Tables
The CUSTOMER Table
The PART Table
The SALE Table
Using Generators
Using Triggers
Using Stored Procedures
Granting Permissions
Using the Data-Definition File
Application Specification
Summary
III.30. Inventory Manager—User Interface Development
The User Interface
The Customer Information Page
The Parts Information Page
The Sales Information Page
Linking to Data
Connecting
Switching Views
Adding New Data
New Part
New Customer
New Sale
Searching
Part Search
Sale Search
Customer Search
Generating Reports
Summary
III.31. Inventory Manager—Finishing Touches
Writing an Installation Program
Writing Utility Routines
Of Strings and PChars
The Famous Backslash
Waiting for Execution of Another Program
Reading Environment Variables
Copying a File
Conversing with Program Manager
Understanding the INI File
[General]
[SubDirs]
[DiskX]
[PMGroup]
Creating the Install User Interface
DirectoryForm
OnCreate: Windows and System Directories
Count the Files
Check Your Paths
Commence Copying
Creating the SETUP Stub
Looking at Other Ideas
Creating the Inventory Manager Install
Determining Which Files You Need
Using the INI File
Summary
III.32. Personal Information Manager—Preliminary Design Issues
Examining the PIM Feature List
Creating the Main Form
Creating the Calendar/Scheduler Page
Creating the Note Taker Page
Creating the Launch Pad Page
Defining a TRunButton
Summary
III.33. Personal Information Manager—User Interface Development
Printing a Calendar
Adding the Note Taker Functionality with TFileStream
Going Gently Down the Stream
TStream
THandleStream
TFileStream
TMemoryStream
Using Streams
Creating the Note Taker Classes
Adding the Note Taker Classes to the PIM
Adding Applications to the Launch Pad
Summary
III.34. Personal Information Manager—Finishing Touches
Adding Help to Your Application
Obtaining the Necessary Tools
Looking at hte Elements of a Help System
Help Topics
Looking at the Help System Structure
Using the PIM's Help System
The Hierarchiy
Making Help Part of the Application
Adding the Help File
Invoking Help
Adding Context-Sensitive Help
Summary
Appendix
A. Error Messages and Exceptions
Layers of Handlers, Layers of Severity
Runtime Errors
DOS Errors
I/O Errors
Nonfatal Erorrs
Fatal Errors
File Modes
Other Exceptions
Index
📜 SIMILAR VOLUMES
Intended to capitalize on the trends towards GUI-based application development using visual programming tools, object-oriention and the need for information technology to solve business problems, this book is not for the novice. Rather, it is for experienced users of Delphi or Pascal and those indiv
The Delphi 5 Developer's Guide is a complete reference showing developers what they need to know most about Delphi 5. The text begins with a tour of Delphi 5 basics, including improvements since version 1. After observing object-oriented Pascal programming, including advanced language features, the
Borland(r) Delphi 6 Developer's Guide is a new edition of the #1 best-selling Delphi book by authors Steve Teixeira and Xavier Pacheco. Steve and Xavier are of the winners of the Delphi Informant Reader's Choice Award for both Delphi 4 Developer's Guide and Delphi 5 Developer's Guide.Borland(r) Delp
If you're into, or getting into, .NET programming with Delphi, this is a good reference. I am a professional programmer, and Delphi is one of 4 languages I use on a regular basis. I bought this book, and Cantu's book, about two months ago to ease into ASP.NET from 12 years of VCL programming. Both b