did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780195789119

Introducing Delphi Programming Theory through Practice

by ; ; ;
  • ISBN13:

    9780195789119

  • ISBN10:

    0195789113

  • Edition: 4th
  • Format: Paperback
  • Copyright: 2005-07-28
  • Publisher: Oxford University Press
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $78.93

Summary

The fourth edition of Introducing Delphi Programming builds on the strengths of the previous editions to provide an even better introduction to computer programming.

Author Biography

John Barrow is a Professor in the School of Computing at Unisa Linda Miller is a Senior Lecturer in the School of Computing at Unisa Katherine Malan is a Lecturer in Computing Education at CIMSTE (Centre for the Improvement of Mathematics, Science and Technology Education), Unisa Helene Gelderblom is a Senior Lecturer in the School of Computing at Unisa

Table of Contents

Preface v
Introduction to visual programming
1(24)
Purpose of this Chapter
Delphi's Integrated Development Environment
2(3)
The Form Designer
3(1)
The Object Inspector
3(1)
Properties
4(1)
The Component palette or Tool palette
4(1)
The Object TreeView or Model View
5(1)
Example 1.1 A simple program
5(6)
Writing a program statement
6(1)
The Speed bar
6(1)
Running the program
7(1)
Exiting the program
7(1)
An event handler
8(1)
Setting a property in the Object Inspector and in the program
9(1)
Naming and saving projects
10(1)
Example 1.2 Dealing with errors
11(1)
Making more errors
11(1)
Diagnosing errors
12(1)
Example 1.3 Another button, another colour
12(7)
Ex 1.3 Step 1 Adding another button
14(1)
Ex 1.3 Step 2 More program statements
15(1)
Understanding event driven programming
16(1)
Ex 1.3 Step 3 Enabling and disabling buttons
16(1)
Making life easier for the user
17(1)
Ex 1.3 Step 4 Accelerator (or hot) keys
18(1)
The interaction between the Form Designer, the Object Inspector, and the Object TreeView or Model View
18(1)
A note for experienced programmers
18(1)
Review
19(1)
Important Concepts
19(2)
New Delphi Features
21(1)
Problems
22(3)
Programming with visual components
25(22)
Purpose of this Chapter
Example 2.1 Simple text output
26(2)
Example 2.2 Reading text in from the user
28(2)
Assignment statement
29(1)
Reading in text from the keyboard
30(1)
Example 2.3 The `Close' bitmap button
30(1)
Example 2.4 Setting focus and clearing text
31(2)
Economy: Making life easier for the user
32(1)
Method calls
32(1)
Selecting components on a form
32(1)
Example 2.5 Positioning and sizing components
33(1)
Example 2.6 GroupBox and RadioButton components
34(2)
Selecting multiple components
35(1)
Example 2.7 Setting form colours with RadioButtons
36(3)
When to use RadioButtons
38(1)
Example 2.8 Two groups of RadioButtons
39(2)
Listing valid methods and properties through Code Completion
40(1)
A comment on the examples in this chapter
41(1)
Review
41(1)
Important Concepts
41(2)
New Delphi Features
43(2)
Problems
45(2)
String variables
47(19)
Purpose of this Chapter
The notion of a variable
48(1)
Example 3.1 Text input and output using a variable
48(2)
Programming instructions versus program comments
49(1)
Associating values with variable names
49(1)
The type part of a variable declaration
50(1)
Example 3.2 What happens if we don't declare a variable?
50(1)
Undeclared identifiers
50(1)
Example 3.3 Experimenting with incompatible types
51(1)
The name part of a variable declaration
51(1)
Example 3.4 Trying out a few names for components
52(1)
Character strings
53(1)
Example 3.5 Using string variables and a ListBox
53(3)
String variables
55(1)
The ListBox component
55(1)
String concatenation
55(1)
Example 3.6 A program using string concatenation
56(3)
Ex 3.6 Step 1 Creating the screen layout
57(1)
Ex 3.6 Step 2 The variables
57(1)
Ex 3.6 Step 3 Doing the concatenation
58(1)
Ex 3.6 Step 4 Adding the couple to the ListBox
58(1)
The number of variables used
59(1)
Variable scope: subroutine level and unit level
59(1)
Example 3.7 When is a variable necessary?
59(3)
Ex 3.7 Step 1 Creating the screen layout
60(1)
Ex 3.7 Step 2 First attempt at the event handler
60(1)
Ex 3.7 Step 3 Second attempt at at the event handler using a variable
61(1)
Review
62(1)
Important Concepts
62(1)
New Delphi Features
63(1)
Problems
63(3)
Using numbers
66(32)
Purpose of this Chapter
Example 4.1 A simple calculator (integer addition)
67(5)
Finding the SpinEdit component
67(1)
Consistent user interfaces
68(1)
Ex 4.1 Adding the numbers
68(1)
Declaring an integer
68(1)
The SpinEdit component
68(1)
Assignment and arithmetic expressions
69(1)
Converting an integer to a string
70(1)
Numbers in strings
71(1)
Integer arithmetic
71(1)
Integer division: MOD and DIV
71(1)
SpinEdit and Samples tab
72(1)
Example 4.2 Extended calculator (integer arithmetic)
72(7)
Ex 4.2 Step 1 Creating the screen layout
73(1)
Ex 4.2 Step 2 Doing the arithmetic
74(1)
Ex 4.2 Step 3 The remaining four operator buttons
75(1)
Why do we declare Answer in each event handler?
76(1)
Ex 4.2 Step 4 Resetting values
76(1)
Floating point (real) numbers
76(1)
Run-time errors
77(1)
Disabling debugger exception handling
78(1)
Typing a real number into a SpinEdit
79(1)
Example 4.3 Rand to Euro calculator (version 1)
79(5)
Floating point (real) data types
80(1)
Converting a real number to a string with FloatToStrF
81(1)
More examples of FloatToStrF conversions
82(1)
FloatToStrF versus FloatToStr
82(1)
Using a constant for the exchange rate
83(1)
Constants
84(1)
Example 4.4 Rand to Euro calculator (version 2)
84(8)
Ex 4.4 Step 1 Creating the screen layout
85(1)
Giving the user hints
86(1)
Ex 4.4 Step 2 Using constants
87(1)
Ex 4.4 Step 3 The variables needed
87(1)
Ex 4.4 Step 4 Converting the user's input to a floating-point number
87(1)
Ex 4.4 Step 5 Doing the calculation
87(1)
Real division
88(1)
Operator precedence
88(1)
Data type of the result of an expression
89(1)
Ex 4.4 Step 6 Displaying the answer
90(1)
Ex 4.4 Step 7 Clearing values
90(1)
Both conversion event handlers
90(1)
Attempting to convert alphabetical characters to a number
91(1)
Review
92(1)
Important Concepts
92(1)
New Delphi Features
93(1)
Problems
94(4)
Conditional execution
98(29)
Purpose of this Chapter
Boolean expressions
99(1)
Example 5.1 Boolean expressions
99(4)
The if...then...else statements
102(1)
The difference between = and :=
102(1)
Comparing strings
103(1)
Example 5.2 Comparing strings
103(3)
Ignoring the case when comparing strings
104(1)
The if...then...else statement
105(1)
Logical operators in Boolean expressions
105(1)
Example 5.3 Ifs, logical operators and Boolean variables
106(4)
Boolean variables
107(1)
Component properties in Boolean expressions
107(1)
Ex 5.3 Working through the program code
108(1)
Evaluating case 1: Step 1
108(1)
Evaluating case 1: Step 2
108(1)
Evaluating case 1: Step 3
109(1)
Important comment
109(1)
Order of precedence
109(1)
Example 5.4 Compound statements
110(4)
Structuring an if...then...else statement
112(1)
Semicolons in if...then...else statements
112(1)
Common Windows dialogs in Delphi
113(1)
Example 5.5 Windows common dialogs
114(8)
Ex 5.5 Step 1 Create the form
114(1)
Visual versus non-visual components
115(1)
Ex 5.5 Step 2 Loading text from a file
115(2)
The Execute method
117(1)
Ex 5.5 Step 3 Opening a file that doesn't exist
117(1)
Ex 5.5 Step 4 Exception handling
118(1)
The try...except statement
119(1)
Ex 5.5 Step 5 Saving text to a file
119(1)
Ex 5.5 Step 6 Exception handling in the Save text event handler
120(1)
Ex 5.5 Step 7 Changing the Memo's font
120(1)
Loading and saving text in Memos and ListBoxes
121(1)
Review
122(1)
Important Concepts
122(1)
New Delphi Features
123(2)
Problems
125(2)
Nested and multiple conditions
127(37)
Purpose of this Chapter
Example 6.1 A nested If statement
128(2)
The layout of nested If statements
128(2)
Example 6.2 Calculating commission on sales
130(5)
A first attempt
131(1)
Ex 6.2 Step 1 Creating the form
132(1)
Ex 6.2 Step 2 Converting the input to a real value
132(1)
Ex 6.2 Step 3 A nested If statement
132(2)
The order of conditions
134(1)
Ex 6.2 Step 4 Displaying the output
134(1)
Ex 6.2 Step 5 Creating the event handler
135(1)
Example 6.3 Improving nested Ifs
135(4)
The CheckBox component
136(1)
A better solution
137(1)
Further improvement
137(1)
The Case statement
138(1)
Example 6.4 A bursary scheme
139(5)
Ex 6.4 Step 1 Creating the form
140(1)
Ex 6.4 Step 2 A simplified version using a Case statement
140(1)
Ex 6.4 Step 3 Including the subject requirements
141(1)
The structure of a Case statement
142(1)
When is a Case statement preferable to an If statement?
143(1)
Ex 6.4 Step 4 Using RadioButtons to get the score
143(1)
Example 6.5 Generating words from characters
144(2)
The relationship between characters and strings
144(1)
Ex 6.5 Step 1 Creating the form
145(1)
Ex 6.5 Step 2 Writing the event handler
146(1)
Example 6.6 Classifying names with a Case statement
146(3)
Input dialog boxes
147(1)
String processing
148(1)
Example 6.7 String manipulation
149(4)
Ex 6.7 Step 1 The event handlers
150(1)
The Memo's Text property
151(1)
Ex 6.7 Step 2 Finding a substring in a string
151(1)
Ex 6.7 Step 3 Deleting a substring from a string
151(1)
Ex 6.7 Step 4 Inserting a substring into a string
152(1)
Copying part of a string
152(1)
Example 6.8 Message dialog boxes
153(4)
Dialog box examples
153(2)
Ex 6.8 Handling exceptions using message dialogs
155(2)
Review
157(1)
Important Concepts
157(1)
New Delphi Features
158(3)
Problems
161(3)
Repetition
164(28)
Purpose of this Chapter
Example 7.1 A For loop
165(6)
Ex 7.1 Step 1 Creating the form
165(1)
Ex 7.1 Step 2 Calculating the sum
166(1)
Trace tables
166(1)
Initializing variables
167(1)
The For loop
168(1)
Counting downwards with For
169(1)
Compound statements with For
169(1)
Changing the upper bound inside the loop
170(1)
Example 7.2 A raffle competition
171(5)
The Random function
171(1)
Ex 7.2 Step 1 The user interface
172(1)
Ex 7.2 Step 2 The For statement
172(1)
Ex 7.2 Step 3 The loop's body
173(1)
Ex 7.2 Step 4 The complete For loop
173(1)
Ex 7.2 Step 5 The event handler
174(1)
The Randomize procedure
174(1)
Commenting code effectively
175(1)
Example 7.3 Nested For loops
176(1)
The While...do statement
176(1)
Example 7.4 A While...do statement
177(1)
Two important rules
177(1)
Example 7.5 Finding a name in a Memo
178(6)
Ex 7.5 Step 1 Creating the form
179(1)
Ex 7.5 Step 2 Saving names to and loading names from a file on disk
179(1)
Ex 7.5 Step 3 Finding the name
180(1)
Numbering and counting the lines in a Memo
181(1)
Problems with the solution
181(1)
Ex 7.5 Step 4 An improved version of the event handler
182(1)
Ex 7.5 Step 5 Resetting the input fields
183(1)
Choosing between For and While
184(1)
Example 7.6 Nested loops
184(3)
The loops
184(1)
Ex 7.6 Step 1 The body of the outer loop
185(1)
Ex 7.6 Step 2 The program
185(2)
The Repeat...until loop
187(1)
Review
187(1)
Important Concepts
188(1)
New Delphi Features
188(1)
Problems
189(3)
Arrays and indexes
192(39)
Purpose of this Chapter
Strings and indexes
193(1)
Example 8.1 Reversing a string
193(2)
Ex 8.1 Step 1 Creating the form
193(1)
Arrays
194(1)
Example 8.2 Reversing five strings
195(5)
Ex 8.2 Step 1 Creating the form
196(1)
Ex 8.2 Step 2 Creating the event handler
197(1)
Looping through an array
198(1)
Ex 8.2 Step 3 Programming the second button
198(1)
Scope and unit-level declarations
199(1)
Ex 8.2 Step 4 Declaring array Words as a unit-level variable
199(1)
Dynamic arrays
200(1)
Example 8.3 Test results
200(6)
Ex 8.3 Step 1 Creating the form
202(1)
Ex 8.3 Step 2 Creating the event handler
202(2)
Initialising arrays and array constants
204(1)
Two-dimensional arrays
205(1)
The ComboBox component
205(1)
Example 8.4 ComboBoxes and two-dimensional arrays
206(3)
Ex 8.4 Step 1 Create the form
206(1)
Ex 8.4 Step 2 Defining the array constants
207(1)
Ex 8.4 Step 3 Loading the ComboBoxes with values
208(1)
The ItemIndex property
208(1)
Ex 8.4 Step 4 Showing the distances
209(1)
Example 8.5 ListBoxes
209(5)
Ex 8.5 Step 1 The interface
210(1)
Ex 8.5 Step 2 Deleting names from the list
211(1)
The Delete method
212(1)
Initialization of variables
212(1)
Ex 8.5 Step 3 A problem with the solution
213(1)
RadioGroups
213(1)
Example 8.6 Using a RadioGroup
214(4)
Ex 8.6 Step 1 Open the project
215(1)
Ex 8.6 Step 2 The interface
215(1)
Ex 8.6 Step 3 The code
216(1)
Using a Case statement with the RadioGroup
217(1)
An alternative solution
217(1)
Example 8.7 Sixpence Joe (a short version)
218(7)
Ex 8.7 Step 1 Open the Sixpence Joe program
218(1)
Ex 8.7 Step 2 Remove the event handlers from the program
218(1)
Ex 8.7 Step 3 The RadioGroup
218(1)
Ex 8.7 Step 4 The RadioGroup's event handler
219(1)
Example 8.8 The Controls and ControlCount properties
219(1)
Ex 8.8 Step 1 Creating the interface
220(1)
Ex 8.8 Step 2 Resetting the components
221(1)
The Controls and ControlCount properties
222(1)
Typecasting
222(1)
Unchecking the CheckBoxes
223(1)
The Components and ComponentCount properties
223(2)
Review
225(1)
Important Concepts
225(1)
New Delphi Features
226(2)
Problems
228(3)
Menus and actions
231(31)
Purpose of this Chapter
Menus
232(1)
Example 9.1 Drop-down, cascading and pop-up menus
232(13)
Ex 9.1 Step 1 Adding a menu to the form
233(2)
Ex 9.1 Step 2 Associating events and shortcuts with the MenuItems
235(1)
Shortcuts versus accelerator keys
236(1)
Editing a menu
236(1)
Ex 9.1 Step 3 Adding a main MenuItem
237(1)
Ex 9.1 Step 4 Adding an item to a drop-down menu
237(1)
The ColorDialog component
238(1)
Ex 9.1 Step 5 Adding a cascading submenu
239(1)
Cascading submenus
239(1)
Ex 9.1 Step 6 Changing the font using checkmarked menu items
240(1)
Checking and unchecking menu items
240(1)
Sets
241(2)
Ex 9.1 Step 7 Adding a pop-up menu
243(1)
Ex 9.1 Step 8 Associating events with the pop-up menu items
244(1)
Using existing event handlers
244(1)
Example 9.2 Action lists
245(11)
Ex 9.2 Step 1 Creating the form
246(1)
Ex 9.2 Step 2 Creating an Action list
247(3)
Ex 9.2 Step 3 Linking buttons to the Actions
250(1)
Action properties
250(1)
Ex 9.2 Step 4 Adding a main menu
250(2)
Ex 9.2 Step 5 Creating shortcuts for all the menu items
252(1)
Ex 9.2 Step 6 Adding a pop-up menu
253(1)
Ex 9.2 Step 7 Enabling/disabling the Actions
253(2)
When different sources trigger the same operation
255(1)
Review
256(1)
Important Concepts
256(1)
New Delphi Features
257(2)
Problems
259(3)
Events and parameters
262(19)
Purpose of this Chapter
Event-driven programming
263(1)
Example 10.1 OnMouseMove event handlers
263(3)
Accessing context-sensitive online Help
264(1)
Writing the event handlers
264(2)
User events and system events
266(1)
Example 10.2 Generating system events through the Timer
266(2)
Visual and non-visual components
267(1)
The Timer
267(1)
Example 10.3 Combining system and user events
268(3)
Ex 10.3 Step 1 Enabling the Timer programmatically
269(1)
Ex 10.3 Step 2 Routing events
270(1)
Ex 10.3 Step 3 Renaming event handlers
270(1)
Ex 10.3 Step 4 Some final touches
270(1)
Example 10.4 The `form' system events
271(1)
Example 10.5 Parameters in event handlers
271(2)
Ex 10.5 Step 1 Positioning squares
273(1)
Example 10.6 Help for the OnMouseDown event parameters
273(1)
Example 10.7 Detecting the left mouse button
274(1)
Review
275(1)
Important Concepts
275(1)
New Delphi Features
276(1)
Problems
277(4)
Methods and parameters
281(11)
Purpose of this Chapter
Example 11.1 Methods and the Memo component
282(2)
Example 11.2 Methods with constants as parameters
284(2)
Ex 11.2 Step 1 The meaning of the parameters
285(1)
Ex 11.2 Step 2 Test the program
286(1)
Example 11.3 The order of parameters
286(1)
Changing parameter order
286(1)
Example 11.4 Wrong type or number of parameters
287(2)
Specifying a method call
288(1)
Review
289(1)
Important Concepts
289(1)
New Delphi Features
290(1)
Problems
291(1)
Procedures and parameters
292(43)
Purpose of this Chapter
Declaring and defining a method
293(1)
Example 12.1 Procedures and Sixpence Joe
294(4)
Calling (invoking) a procedure
296(1)
The structure of a simple procedure
296(1)
Reasons for using procedures
297(1)
General comments on procedures
297(1)
Example 12.2 Parameter list matching
298(1)
Example 12.3 Parameter names
299(1)
Example 12.4 Declare the method in the type declaration
299(1)
Example 12.5 Variables as parameters
300(1)
Example 12.6 A method is part of a class
301(1)
Example 12.7 Components as parameters
301(6)
Ex 12.7 Step 1 The program without procedures
301(2)
Ex 12.7 Step 2 Introducing a simple method
303(2)
Ex 12.7 Step 3 Passing a component as a parameter
305(1)
Why and when should we use procedures?
306(1)
Commenting a method
307(1)
Example 12.8 Returning values from a procedure
307(4)
Ex 12.8 Step 1 The Inc(x) procedure
307(1)
Ex 12.8 Step 2 A var parameter
308(1)
The method CalcFee
309(1)
Returning to the event handler: using the variable parameter's value
310(1)
Error: leaving out the `var'
310(1)
Hiding detail with a method
311(1)
Example 12.9 Sixpence Joe's selling price calculator
311(9)
User interface
311(1)
Incremental development
312(1)
Ex 12.9 Step 1 The user interface
313(2)
Ex 12.9 Step 2 Calculating 15% markup directly
315(1)
Ex 12.9 Step 3 Creating procedure methods
316(1)
Ex 12.9 Step 4 Adding further event handlers
317(1)
Ex 12.9 Step 5 Testing the program
318(1)
Ex 12.9 Step 6 Some refinements
318(2)
Example 12.10 Variable parameters in event handlers
320(2)
Delphi's event signatures
321(1)
User interface factors: reversibility vs economy
321(1)
Delphi's other parameter types
322(1)
Review
322(1)
Important Concepts
323(4)
New Delphi Features
327(1)
Problems
327(8)
Functions and exceptions
335(30)
Purpose of this Chapter
Delphi's standard functions
336(1)
Example 13.1 A simple function
336(4)
Ex 13.1 Step 1 Run and test the program
338(1)
Ex 13.1 Step 2 How do we write a function?
338(1)
Ex 13.1 Step 3 Supplying the function's value to the calling statement
339(1)
Ex 13.1 Step 4 How do we use a function?
340(1)
Ex 13.1 Step 5 Displaying the output
340(1)
Ex 13.1 Step 6 Soft click
340(1)
Example 13.2 Joe's Security Emporium
340(6)
Ex 13.2 Step 1 The program operation
343(2)
Ex 13.2 Step 2 Procedures or functions?
345(1)
Ex 13.2 Step 3 Enhancing the If statements
345(1)
Example 13.3 Henry's `Horse Heaven' Farm
346(5)
Ex 13.3 Step 1 Changes to the form
347(1)
Ex 13.3 Step 2 Changing the code
347(2)
Ex 13.3 Step 3 Comments on each subroutine
349(1)
Ex 13.3 Step 4 Alternative implementations
350(1)
Differences between functions and procedures
350(1)
Example 13.4 Nested function calls
351(1)
Example 13.5 Exception handling
352(5)
Ex 13.5 Step 1 Accepting three characters only
353(1)
Ex 13.5 Step 2 Generating an Invalid Status
354(1)
Ex 13.5 Step 3 The try...finally construct
355(1)
Ex 13.5 Step 4 Handling the exceptions closer to the source
356(1)
Review
357(1)
Important Concepts
358(2)
New Delphi Features
360(1)
Problems
361(4)
Debugging and testing
365(18)
Purpose of this Chapter
Preliminary
366(1)
Example 14.1 Breakpoints and tracing
367(3)
Ex 14.1 Step 1 btnParSec's OnClick handler
367(1)
Ex 14.1 Step 2 Setting breakpoints
368(2)
Example 14.2 Method calls and watches
370(10)
Ex 14.2 Step 1 Introducing a method
370(1)
Ex 14.2 Step 2 Tracing flow to a method and back
371(1)
Ex 14.2 Step 3 Setting the Watch List
372(1)
Ex 14.2 Step 4 Tracing into, stepping over, and other niceties
373(1)
Ex 14.2 Step 5 Value and variable parameters
373(2)
Ex 14.2 Step 6 Parameter order
375(1)
Additional Debug features
376(1)
Types of error
376(2)
Testing
378(2)
Review
380(1)
Important Concepts
381(1)
New Delphi Features
382(1)
Problems
382(1)
Introduction to database programming
383(31)
Purpose of this Chapter
What is a database?
384(1)
Delphi's alternatives in terms of data access
384(1)
MySQL database
385(1)
A library database application
385(1)
Example 15.1 Create the database containing one table
386(5)
Ex 15.1 Step 1 Make sure the MySQL server is running
387(1)
Ex 15.1 Step 2 Connecting to the database server
387(1)
Ex 15.1 Step 3 Create the database
388(1)
Ex 15.1 Step 4 Create table LibraryMember
389(1)
What is a key?
390(1)
Ex 15.1 Step 5 Change the structure of the table
391(1)
Handling database errors
391(1)
Example 15.2 Create an application that uses the table through a DBGrid component
391(10)
Ex 15.2 Step 1 Build the connection to the database
391(2)
Ex 15.2 Step 2 Add the dbExpress and DataAccess components
393(1)
Ex 15.2 Step 3 Add the data control components
393(1)
Ex 15.2 Step 4 Specify the display lengths of the data in the DBGrid
394(1)
Ex 15.2 Step 5 Run the application
394(1)
A local (unidirectional) data set
395(1)
Bringing the database and the application together
396(1)
The SQLConnection component
397(1)
The SQLDataSet component
397(1)
The DataSetProvider component
397(1)
The ClientDataSet component
398(1)
The DataSource component
398(1)
The data control component: DBGrid
398(1)
Ex 15.2 Step 6 Apply the updates to the database
399(1)
The ClientDataSet's ChangeCount property
399(1)
The ClientDataSet's ApplyUpdates method
399(1)
Ex 15.2 Step 7 Undo data updates
399(1)
The ClientDataSet's UndoLastChange method
400(1)
Opening and closing data sets correctly
400(1)
Ex 15.2 Step 8 Open the ClientDataSet when the form is displayed
400(1)
Example 15.3 Creating the book data table and using it in an application
401(5)
Ex 15.3 Step 1 Create the LibraryBook table in database MyVPLibrary
401(1)
Creating an application to add data to the LibraryBook table in database MyVPLibrary
401(1)
Ex 15.3 Step 2 Build the connection to the database
402(1)
Ex 15.3 Step 3 Add the dbExpress and DataAccess components
402(1)
Ex 15.3 Step 4 Add the DBEdit Data Control components
403(1)
Ex 15.3 Step 5 Write the event handlers
404(1)
Ex 15.3 Step 6 Run the application
404(1)
The current record
405(1)
The DBEdit data control
405(1)
DBNavigator data control
405(1)
Example 15.4 Change example 15.3 to use a DBComboBox
406(2)
The DBComboBox
407(1)
When the primary key consists of more than one field: The SQLDataSet component
407(1)
Review
408(1)
Important Concepts
408(1)
New Delphi Features
409(3)
Problems
412(2)
Database programming using data modules and multiple forms
414(40)
Purpose of this Chapter
Example 16.1 Database maintenance | Member table... and Book table...
415(10)
Ex 16.1 Step 1 Create the main form of the application
416(1)
Ex 16.1 Step 2 Add the Member and Book forms to the project
417(1)
Multiple forms and units in an application
417(1)
The Project Options
418(1)
Ex 16.1 Step 3 Add code to activate frmMember from the main form
418(1)
Ex 16.1 Step 4 Make unit Memberu accessible from the main form
419(1)
Ex 16.1 Step 5 Adding code to activate frmBook from the main form
419(1)
Ex 16.1 Step 6 Running the application without making unit Booku accessible to the main form
419(1)
Showing forms: modal and modeless
420(1)
User interface factors: modal vs modeless
420(1)
Using a data module
421(1)
Ex 16.1 Step 7 Create a data module for the Data Access and dbExpress components
421(1)
Ex 16.1 Step 8 Move the dbExpress and Data Access components from frmMember to the data module
422(1)
Ex 16.1 Step 9 Linking to the data module
422(1)
Ex 16.1 Step 10 Access the data module from frmMember's event handlers
423(1)
Ex 16.1 Step 11 Modify frmBook to use the data module
424(1)
Ex 16.1 Step 12 Linking the DBEdits on frmBook to the data module
424(1)
Ex 16.1 Step 13 Accessing the data module from frmBook's event handlers
424(1)
Example 16.2 Library acquisitions: using an SQL statement and adding records programmatically
425(10)
Ex 16.2 Step 1 Create table LibraryAcquisition in database MyVPLibrary
426(1)
Ex 16.2 Step 2 Add the dbExpress and Data Access components for LibraryAcquisition to the data module
427(1)
Ex 16.2 Step 3 Create the new form and activate it from the main form
427(2)
The DBLookupComboBox component
429(1)
The DBText component
429(1)
Ex 16.2 Step 4 Create event handlers FormClose, UndoLastChange and FormShow
429(1)
SQL's SELECT statement
430(1)
The SQL query in TfrmAcquisition.FormShow
431(1)
Ex 16.2 Step 5 Refreshing the ClientDataSet for the books
432(1)
The ClientDataSet's Refresh method
432(1)
Ex 16.2 Step 6 Using DateUtils
432(1)
Ex 16.2 Step 7 The Generate new acquisition number event handler
433(1)
Date operations
433(1)
Working with the ClientDataSet
434(1)
Example 16.3 Library loans | Issue book
435(7)
Clicking the Issue book... menu item
435(1)
Ex 16.3 Step 1 Create the LibraryLoan table
436(1)
Ex 16.3 Step 2 Add LibraryLoan to the data module
436(1)
What happens when a book is issued
436(1)
Ex 16.3 Step 3 Creating the form for issuing a book
437(2)
Ex 16.3 Step 4 Make unit IssueBooku accessible from C16e01u
439(1)
Ex 16.3 Step 5 The event handlers for frmIssueBook
439(2)
Searching for a specific record using the FindKey method
441(1)
Date routines
441(1)
Getting values from and entering values into the fields of the new record
441(1)
Example 16.4 Returning or renewing a book
442(5)
Ex 16.4 Step 1 Create the Return / Renew book form
442(1)
Ex 16.4 Step 2 Displaying the form from the main menu
443(1)
Ex 16.4 Step 3 The event handlers and method
443(2)
The ClientDataSet's FindNearest method
445(1)
The application now
446(1)
Exception handling
446(1)
The DateTimePicker component
446(1)
Review
447(1)
INew Delphi Features
447(3)
Problems
450(4)
Reporting: using Rave reports
454(32)
Purpose of this Chapter
Rave reports
455(1)
Example 17.1 Introducing Rave: printing/viewing late return notices
455(10)
Ex 17.1 Step 1 Change the due dates in some records for testing purposes
456(1)
Ex 17.1 Step 2 TrvProject and TrvSystem components
456(1)
The RvProject and RvSystem components
456(1)
Ex 17.1 Step 3 The Rave Visual Designer
456(1)
The Project TreeView
457(1)
Ex 17.1 Step 4 Executing the report from the application
458(1)
Ex 17.1 Step 5 Interact with the Rave project using parameters
459(1)
Ex 17.1 Step 6 Setting the DataField properties of the DataText components
460(2)
Ex 17.1 Step 7 Set the parameter values in the application
462(1)
Project Parameters
462(1)
Ex 17.1 Step 8 Select a specific report
463(1)
Global pages
463(1)
Ex 17.1 Step 9 Add a common header to our reports
463(1)
Mirroring
464(1)
Report Variables
465(1)
Example 17.2 Create a Data Aware report using Bands
465(5)
Ex 17.2 Step 1 Add a RvDataSetConnection component
465(1)
Ex 17.2 Step 2 Design a new report in Rave project LibraryReports.rav
466(1)
The Data Viewer (Delphi 8)
466(1)
Ex 17.2 Step 3 Add the global header from GlobalPage1
466(1)
Ex 17.2 Step 4 Create the report title, the Region and the Bands
467(1)
Bands and Regions
468(1)
Ex 17.2 Step 5 Add the column headers and fields
468(1)
Ex 17.2 Step 6 Generate the report from the application
469(1)
Example 17.3 Create a data aware report using an SQL query
470(2)
Ex 17.3 Step 1 Add the dbExpress, Data Access and Rave components
470(1)
Ex 17.3 Step 2 Define the new report in Rave
471(1)
Ex 17.3 Step 3 Create the event handler
472(1)
Example 17.4 More detail through a more sophisticated SQL
472(6)
Ex 17.4 Step 1 Develop and test the SQL query in MySQL Control Center
473(2)
Ex 17.4 Step 2 Add dbExpress and Data Access components to provide the correct Data View for the report
475(1)
Ex 17.4 Step 3 Define the new report in Rave
476(2)
Ex 17.4 Step 4 The event handler
478(1)
Example 17.5 Neaten up the application
478(3)
Ex 17.5 Step 1 Create the procedure
479(1)
Ex 17.5 Step 2 Change the event handlers
480(1)
Review
481(1)
Important Concepts
481(1)
New Delphi Features
482(3)
Problems
485(1)
Investigating objects
486(49)
Purpose of this Chapter
Example 18.1 The basic `unit' file
487(2)
The unit name
487(1)
The interface section
488(1)
The implementation section
488(1)
Example 18.2 Extending the basic application
489(2)
Changing the form's name
490(1)
Adding buttons
490(1)
Adding event handlers
491(1)
Example 18.3 Creating our own classes and objects
491(6)
Ex 18.3 Step 1 The overall framework
492(1)
Ex 18.3 Step 2 The TCounter class
493(1)
The Code Explorer
494(1)
Ex 18.3 Step 3 Using the class
495(2)
Example 18.4 Extending TCounter
497(11)
Ex 18.4 Step 1 Inheriting from TCounter
497(2)
Ex 18.4 Step 2 Using the new class
499(4)
Navigating through the Code Explorer
503(1)
The Project Browser
503(1)
Simple object orientation (OO)
504(1)
Basic object-orientation principles
504(1)
Classes and objects
505(1)
Encapsulation
506(1)
Efficiency, reliability and re-use through inheritance
506(2)
Composition -- combining objects
508(1)
Example 18.5 The Sender parameter in event handlers
508(6)
Ex 18.5 Step 1 Static design (user interface)
509(1)
Ex 18.5 Step 2 The OnClick event handler (version 1)
510(1)
Ex 18.5 Step 3 Using the Sender parameter
510(1)
Ex 18.5 Step 4 Linking in the other SpeedButtons
511(1)
Ex 18.5 Step 5 Testing the Sender parameter
512(1)
Ex 18.5 Step 6 Substitution
512(1)
Ex 18.5 Step 7 An alternative typecasting operator
513(1)
Ex 18.5 Step 8 The equality operator
514(1)
Review
514(1)
Important Concepts
515(1)
New Delphi Features
516(1)
Problems
517(4)
Appendices
Appendix 1 Deployment
521(5)
Appendix 2 File types
526(2)
Appendix 3 Component naming conventions
528(2)
Appendix 4 Installation notes
530(5)
Index 535

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program