Muutke küpsiste eelistusi

Introducing Delphi Programming: Theory Through Practise [Pehme köide]

Contributions by , , Contributions by , Contributions by
  • Formaat: Paperback / softback, 544 pages, kõrgus x laius: 280x210 mm, kaal: 1273 g, illustrated
  • Ilmumisaeg: 07-Aug-2003
  • Kirjastus: Oxford University Press Southern Africa
  • ISBN-10: 019578135X
  • ISBN-13: 9780195781359
Teised raamatud teemal:
  • Pehme köide
  • Hind: 59,05 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 544 pages, kõrgus x laius: 280x210 mm, kaal: 1273 g, illustrated
  • Ilmumisaeg: 07-Aug-2003
  • Kirjastus: Oxford University Press Southern Africa
  • ISBN-10: 019578135X
  • ISBN-13: 9780195781359
Teised raamatud teemal:
Written by three members of the UNISA Department of Information Systems, the book teaches distance-learning students: how to program in Delphi, a major computer language used to design a variety of programs.
Preface v
1 Introduction to visual programming
1(23)
PURPOSE OF THIS CHAPTER
Example 1.1 A simple program
2(7)
The Form Designer
2(1)
The Object TreeView
3(1)
The Object Inspector
3(1)
Properties
3(1)
The Component palette
4(1)
Placing a button on the form
4(1)
Writing a program statement
5(1)
The Speed bar
5(1)
Running the program
6(1)
Exiting the program
6(1)
An event handler
7(1)
Setting a property in the Object Inspector and in the program
8(1)
Example 1.2 Dealing with errors
9(2)
Making more errors
9(1)
Diagnosing errors
10(1)
Naming and saving projects
10(1)
Example 1.3 Another button, another colour
11(6)
Ex 1.3 Step 1 Adding another button
13(1)
Ex 1.3 Step 2 More program statements
14(1)
Ex 1.3 Step 3 Enabling and disabling buttons
15(1)
Making life easier for the user
16(1)
Ex 1.3 Step 4 Accelerator (or hot) keys
16(1)
The interaction between the Form Designer, the Object Inspector and the Object TreeView
17(1)
A note for experienced programmers
17(1)
REVIEW
17(1)
IMPORTANT CONCEPTS
18(2)
NEW DELPHI FEATURES
20(1)
PROBLEMS
21(3)
2 Programming with visual components
24(22)
PURPOSE OF THIS CHAPTER
Example 2.1 Simple text input and output
25(2)
Example 2.2 Reading text in from the user
27(2)
Assignment statement
28(1)
Summary: reading in text from the keyboard
29(1)
Example 2.3 The 'Close' bitmap button
29(1)
Example 2.4 Setting focus and clearing text
30(2)
Method calls
31(1)
Selecting components on a form
31(1)
Example 2.5 Positioning and sizing components
32(1)
Example 2.6 GroupBox and RadioButton components
33(2)
Selecting multiple components
34(1)
Example 2.7 Setting form colours with RadioButtons
35(2)
When to use RadioButtons
37(1)
Example 2.8 Two groups of RadioButtons
37(2)
A comment on the examples in this chapter
39(1)
REVIEW
39(1)
IMPORTANT CONCEPTS
40(1)
NEW DELPHI FEATURES
41(2)
PROBLEMS
43(3)
3 String variables
46(16)
PURPOSE OF THIS CHAPTER
The notion of a variable
47(1)
Example 3.1 Text input and output using a variable
47(2)
Programming instructions versus program comments
48(1)
Associating values with variable names
48(1)
The 'type' part of a variable declaration
49(1)
Example 3.2 What happens if we don't declare a variable?
49(1)
Undeclared identifiers
49(1)
The scope of a variable
50(1)
Example 3.3 Experimenting with incompatible types
50(1)
The 'name' part of a variable declaration
50(1)
Example 3.4 Trying out a few names for components
51(2)
Character strings
52(1)
Example 3.5 Using string variables and a ListBox
53(2)
String variables
54(1)
The ListBox component
55(1)
String concatenation
55(1)
Example 3.6 A program using string concatenation
55(3)
Ex 3.6 Step 1 Creating the screen layout
56(1)
Ex 3.6 Step 2 The variables
56(1)
Ex 3.6 Step 3 Doing the concatenation
57(1)
Concatenating strings
57(6)
Ex 3.6 Step 4 Adding the couple to the ListBox
57(1)
REVIEW
58(1)
IMPORTANT CONCEPTS
58(1)
NEW DELPHI FEATURES
59(1)
PROBLEMS
59(3)
4 Using numbers
62(30)
PURPOSE OF THIS CHAPTER
Example 4.1 A simple calculator (integer addition)
63(5)
Finding the SpinEdit component
63(3)
Ex 4.1 Declaring an integer
64(1)
Ex 4.1 The SpinEdit component
64(1)
Ex 4.1 Arithmetic expressions
65(1)
Ex 4.1 Converting an integer to a string
66(1)
Numbers in strings
66(1)
Integer arithmetic
67(1)
Integer division: MOD and DIV
67(1)
Example 4.2 Extended calculator (integer arithmetic)
68(4)
Ex 4.2 Step 1 Creating the screen layout
69(1)
Ex 4.2 Step 2 Doing the arithmetic
69(1)
Ex 4.2 Step 3 The remaining four operator buttons
70(1)
Why do we declare Answer in each event handler?
71(1)
Ex 4.2 Step 4 Resetting values
71(1)
Floating point (real) numbers
72(1)
Example 4.3 Rand to Euro calculator (version 1)
72(5)
Ex 4.3 Floating point (real) data types
74(1)
Ex 4.3 Converting a real number to a string with FloatToStrF
74(1)
Ex 4.3 FloatToStrF versus FloatToStr
75(1)
Ex 4.3 Using a constant for the exchange rate
76(1)
Constants
77(1)
Example 4.4 Rand to Euro calculator (version 2)
77(9)
Ex 4.4 Step 1 Creating the screen layout
78(1)
Giving the user hints
79(1)
Ex 4.4 Step 2 Using constants
80(1)
Ex 4.4 Step 3 The variables needed
80(1)
Ex 4.4 Step 4 Converting the user's input
80(1)
Converting a character string to a floating-point number
80(1)
Ex 4.4 Step 5 Doing the calculation
81(1)
Real division
81(1)
Another way of doing the calculation
81(1)
Operator precedence
81(1)
Data type of the result of an expression
82(2)
Ex 4.4 Step 6 Displaying the answer
83(1)
Ex 4.4 Step 7 Clearing values
83(1)
Both conversion event handlers
84(1)
Attempting to convert alphabetical characters to a number
84(1)
Disabling debugger exception handling
85(1)
REVIEW
86(1)
IMPORTANT CONCEPTS
86(1)
NEW DELPHI FEATURES
87(1)
PROBLEMS
87(5)
5 Conditional execution
92(30)
PURPOSE OF THIS CHAPTER
Boolean expressions
93(1)
Example 5.1 Boolean expressions
93(4)
The if...then...else statements
96(1)
The difference between = and :=
96(1)
Comparing strings
97(1)
Example 5.2 Comparing strings
97(3)
Ignoring the case when comparing strings
98(1)
The if...then...else statement
99(1)
Logical operators in Boolean expressions
99(1)
Example 5.3 Ifs, logical operators and Boolean variables
100(5)
Ex 5.3 Boolean variables
101(1)
Ex 5.3 Component properties in Boolean expressions
101(1)
Ex 5.3 Delphi's short-circuit Boolean evaluation
102(1)
Ex 5.3 Working through the program code
102(1)
Evaluating case 1: Step 1
102(1)
Evaluating case 1: Step 2
103(1)
Evaluating case 1: Step 3
103(1)
Important comment
104(1)
Order of precedence
104(1)
Example 5.4 Compound statements
105(3)
Structuring an if...then...else statement
106(1)
Semicolons in if...then...else statements
107(1)
Common Windows dialogs in Delphi
108(1)
Example 5.5 Windows common dialogs
108(8)
Ex 5.5 Step 1 Create the form
109(1)
Visual versus non-visual components
109(2)
Ex 5.5 Step 2 Loading text from a file
110(1)
The Execute method
111(1)
Ex 5.5 Step 3 Opening a file that doesn't exist
111(1)
Exception handling
112(1)
The try... except... end statement
113(1)
Ex 5.5 Step 4 Using the on...do statement for exception handling
113(1)
Delphi's exception handlers
113(3)
Ex 5.5 Step 5 Saving text to a file
114(1)
Ex 5.5 Step 6 Exception handling In the Save text event handler
115(1)
Ex 5.5 Step 7 Changing the Memo's font
115(1)
Loading and saving text In Memos and ListBoxes
116(1)
REVIEW
116(1)
IMPORTANT CONCEPTS
117(1)
NEW DELPHI FEATURES
118(2)
PROBLEMS
120(2)
6 Nested and multiple conditions
122(34)
PURPOSE OF THIS CHAPTER
Example 6.1 A nested If statement
123(2)
The layout of nested If statements
123(2)
Example 6.2 Calculating commission on sales
125(8)
Ex 6.2 Step 1 Create the form
126(1)
Ex 6.2 Step 2 Converting the input to a real value
127(1)
Ex 6.2 Step 3 A nested If statement
127(2)
The order of conditions
129(4)
Ex 6.2 Step 4 Displaying the output
129(1)
Ex 6.2 Step 5 Creating the event handler
129(1)
Ex 6.2 Step 6 Data validation
130(1)
Ex 6.2 Step 7 Message boxes
131(2)
Example 6.3 Improving nested Ifs
133(3)
The CheckBox component
134(1)
A better solution
135(1)
Further improvement
135(1)
The Case statement
136(1)
Example 6.4 A bursary scheme
136(4)
Ex 6.4 Step 1 Creating the form
137(1)
Ex 6.4 Step 2 Solving a simplified version of the problem with a Case statement
138(1)
Ex 6.4 Step 3 Including the subject requirements
139(1)
Example 6.5 Using RadioButtons to get the score
140(2)
The structure of a Case statement
141(1)
When Is a Case statement preferable to an If statement?
142(1)
Example 6.6 Classifying names with a Case statement
142(3)
Input dialog boxes
143(2)
String processing
145(1)
Example 6.7 String manipulation
145(4)
Ex 6.7 The event handlers
146(1)
Ex 6.7 The Memo's Text property
147(1)
Ex 6.7 Finding a substring in a string
148(1)
Ex 6.7 Deleting a substring from a string
148(1)
Ex 6.7 Inserting a substring Into a string
148(1)
Copying part of a string
149(1)
REVIEW
149(1)
IMPORTANT CONCEPTS
150(1)
NEW DELPHI FEATURES
150(3)
PROBLEMS
153(3)
7 Repetition
156(24)
PURPOSE OF THIS CHAPTER
Example 7.1 A For loop
157(3)
Ex 7.1 Step 1 Create the form
157(1)
Ex 7.1 Step 2 Calculating the sum
158(1)
Initializing variables
159(1)
The For loop
159(1)
Counting downwards with For
160(1)
Example 7.2 A raffle competition
160(4)
The Random function
160(3)
Ex 7.2 Step 1 The user interface
161(1)
Ex 7.2 Step 2 The For statement
161(1)
Ex 7.2 Step 3 The loop's body
162(1)
Ex 7.2 Step 4 The complete For loop
162(1)
Ex 7.2 Step 5 The event handler
163(1)
More on the For loop
163(1)
Example 7.3 Nested For loops
164(1)
The While...do statement
165(1)
Example 7.4 A While...do statement
165(1)
Two important rules
166(1)
Example 7.5 Finding a name in a Memo
166(6)
Ex 7.5 Step 1 Creating the form
167(1)
Ex 7.5 Step 2 Saving names to and loading names from a file on disk
168(1)
Ex 7.5 Step 3 Finding the name
168(1)
Numbering and counting the lines in a Memo
169(1)
Problems with the solution
169(2)
Ex 7.5 Step 4 An improved version of the event handler
170(1)
Ex 7.5 Step 5 Resetting the input fields
171(1)
Choosing between For and While
171(1)
Example 7.6 Nested loops
172(3)
The loops
172(3)
Ex 7.6 Step 1 The body of the outer loop
173(1)
Ex 7.6 Step 2 The program
173(2)
The Repeat... until loop
175(1)
REVIEW
175(1)
IMPORTANT CONCEPTS
176(1)
NEW DELPHI FEATURES
176(1)
PROBLEMS
177(3)
8 Arrays, lists and indexes
180(37)
PURPOSE OF THIS CHAPTER
Strings and indexes
181(1)
Example 8.1 Reversing a string
181(3)
Ex 8.1 Step 1 Creating the form
181(1)
Arrays
182(1)
Array constants
183(1)
Example 8.2 Arrays, array constants and unit-level declarations
184(6)
Ex 8.2 Step 1 Creating the form
185(1)
Ex 8.2 Step 2 Getting the distances
185(2)
Ex 8.2 Step 3 Resetting the form
187(1)
Ex 8.2 Step 4 Unit-level declarations
187(1)
Ex 8.2 Step 5 Finding the nearest city
188(1)
Two-dimensional arrays
189(1)
The ComboBox component
190(1)
Example 8.3 ComboBoxes and two-dimensional arrays
190(4)
Ex 8.3 Step 1 Create the form
191(1)
Ex 8.3 Step 2 Declaring the array
192(1)
Ex 8.3 Step 3 Loading the distances
192(1)
The Itemindex property
193(1)
Ex 8.3 Step 4 Showing the distances
193(1)
Example 8.4 ListBoxes
194(4)
Ex 8.4 Step 1 The interface
194(1)
Ex 8.4 Step 2 Deleting names from the list
195(1)
The Delete method
196(1)
Initialization of variables
196(1)
An alternative solution
197(1)
Ex 8.4 Step 3 A problem with the solution
197(1)
RadioGroups
198(1)
Example 8.5 Using a RadioGroup
198(4)
Ex 8.5 Step 1 Open the project
199(1)
Ex 8.5 Step 2 The interface
200(1)
Ex 8.5 Step 3 The code
200(1)
Using a Case statement with the RadioGroup
201(1)
An alternative solution
202(1)
Example 8.6 Sixpence Joe (a short version)
202(2)
Ex 8.6 Step 1 Open the Sixpence Joe program
202(1)
Ex 8.6 Step 2 Remove the event handlers from the program
202(1)
Ex 8.6 Step 3 The RadioGroup
203(1)
Ex 8.6 Step 4 The RadioGroup's event handler
203(1)
Example 8.7 The Controls and ControlCount properties
204(5)
Ex 8.7 Step 1 Creating the interface
205(1)
Ex 8.7 Step 2 Resetting the components
206(1)
The Controls and ControlCount properties
206(1)
Typecasting
207(1)
Unchecking the CheckBoxes
207(1)
The Components and ComponentCount properties
208(1)
Example 8.8 An array of edit boxes
209(3)
Ex 8.8 Step 1 Creating the form
209(1)
Ex 8.8 Step 2 Declaring an array of edit boxes
210(1)
Ex 8.8 Step 3 Setting up the array
210(1)
Ex 8.8 Step 4 Putting default values in the edit boxes
211(1)
Ex 8.8 Step 5 Clearing the edit boxes
212(1)
REVIEW
212(1)
IMPORTANT CONCEPTS
213(1)
NEW DELPHI FEATURES
214(1)
PROBLEMS
215(2)
9 Menus and actions
217(31)
PURPOSE OF THIS CHAPTER
Menus
218(1)
Example 9.1 Drop-down, cascading and pop-up menus
218(13)
Ex 9.1 Step 1 Adding a menu to the form
219(2)
Ex 9.1 Step 2 Associating code and a shortcut with the Exit MenuItem
221(1)
Ex 9.1 Step 3 Associating events and shortcuts with the other MenuItems
221(1)
Editing a menu
222(2)
Ex 9.1 Step 4 Adding a main MenuItem
222(1)
Ex 9.1 Step 5 Adding an item to a drop-down menu
223(1)
The ColorDialog component
224(3)
Ex 9.1 Step 6 Adding a cascading submenu
225(2)
Simplifying the code
227(1)
The With statement
227(1)
Checking and unchecking menu items
227(1)
Sets
228(1)
Cascading submenus
229(2)
Ex 9.1 Step 7 Adding a pop-up menu
229(1)
Ex 9.1 Step 8 Associating events with the pop-up menu items
230(1)
Using existing event handlers
231(1)
Example 9.2 Action lists
231(11)
Ex 9.2 Step 1 Creating the form
233(1)
Ex 9.2 Step 2 Creating an Action list
234(2)
Ex 9.2 Step 3 Linking buttons to the Actions
236(1)
Action properties
236(2)
Ex 9.2 Step 4 Adding a main menu
237(1)
Accelerator keys and shortcuts
238(3)
Ex 9.2 Step 5 Creating shortcuts for all the menu items
238(1)
Ex 9.2 Step 6 Adding a pop-up menu
239(1)
Ex 9.2 Step 7 Enabling/disabling the Actions
240(1)
When different sources trigger the same operation
241(1)
REVIEW
242(1)
IMPORTANT CONCEPTS
243(1)
NEW DELPHI FEATURES
244(2)
PROBLEMS
246(2)
10 Events and parameters 248(19)
PURPOSE OF THIS CHAPTER
Event-driven programming
249(1)
Example 10.1 MouseMove event handlers
249(3)
Accessing context-sensitive online Help
250(1)
Writing the event handlers
250(2)
User events and system events
252(1)
Example 10.2 Generating system events through the Timer
252(2)
Visual and non-visual components
253(1)
The Timer
253(1)
Example 10.3 Combining system and user events
254(3)
Ex 10.3 Step 1 Enabling the Timer programmatically
255(1)
Ex 10.3 Step 2 Redirecting events
256(1)
Ex 10.3 Step 3 Renaming event handlers
256(1)
Ex 10.3 Step 4 Some final touches
256(1)
Example 10.4 The 'form' system events
257(1)
Example 10.5 Parameters in event handlers
257(2)
Ex 10.5 Step 1 Positioning squares
259(1)
Example 10.6 Help for the OnMouseDown event parameters
259(1)
Example 10.7 Detecting the left mouse button
260(1)
REVIEW
261(1)
IMPORTANT CONCEPTS
261(2)
NEW DELPHI FEATURES
263(1)
PROBLEMS
263(4)
11 Methods and parameters 267(11)
PURPOSE OF THIS CHAPTER
Example 11.1 Methods and the Memo component
268(2)
Example 11.2 Methods with constants as parameters
270(2)
Ex 11.2 Step 1 The meaning of the parameters
271(1)
Ex 11.2 Step 2 Test the program
272(1)
Example 11.3 The order of parameters
272(1)
Changing parameter order
272(1)
Example 11.4 Wrong type or number of parameters
273(2)
Specifying a method call
274(1)
REVIEW
275(1)
IMPORTANT CONCEPTS
275(1)
NEW DELPHI FEATURES
276(1)
PROBLEMS
277(1)
12 Procedures and parameters 278(39)
PURPOSE OF THIS CHAPTER
Example 12.1 Procedures and Sixpence Joe
279(3)
Calling (invoking) a procedure
280(1)
The structure of a simple procedure
280(1)
General comments on procedures
281(1)
Example 12.2 Parameter list matching
282(1)
Example 12.3 Parameter names
282(1)
Example 12.4 Define procedures before using them
283(1)
Example 12.5 Variables as parameters
284(1)
Example 12.6 A general procedure's independence
285(1)
Example 12.7 Components as parameters
285(6)
Ex 12.7 Step 1 The program without procedures
285(2)
Ex 12.7 Step 2 Introducing a simple procedure
287(2)
Ex 12.7 Step 3 Keeping the general procedure independent
289(1)
Ex 12.7 Step 4 Further simplification
290(1)
Why and when should we use a procedure?
290(1)
Example 12.8 Returning values from a procedure
291(3)
The procedure CalcFee
293(1)
Returning to the event handler: using the variable parameter's value
293(1)
Hiding detail with a procedure
293(1)
Error: leaving out the 'var'
294(1)
Example 12.9 Sixpence Joe's selling price calculator
294(8)
User interface
295(1)
Incremental development
295(7)
Ex 12.9 Step 1 The user interface
296(2)
Ex 12.9 Step 2 Calculating 15% markup directly
298(1)
Ex 12.9 Step 3 Creating procedures
299(2)
Ex 12.9 Step 4 Adding further event handlers
301(1)
Ex 12.9 Step 5 Testing the program
301(1)
Ex 12.9 Step 6 Some refinements
301(1)
Example 12.10 Variable parameters in event handlers
302(2)
Delphi's other parameter types
304(1)
REVIEW
304(1)
IMPORTANT CONCEPTS
305(4)
NEW DELPHI FEATURES
309(1)
PROBLEMS
309(8)
13 Functions and exceptions 317(26)
PURPOSE OF THIS CHAPTER
Example 13.1 A simple function
318(3)
Ex 13.1 Step 1 Run and test the program
319(1)
Ex 13.1 Step 2 How do we write a function?
320(1)
Ex 13.1 Step 3 Supplying the function's value to the calling statement
320(1)
Ex 13.1 Step 4 How do we use a function?
321(1)
Ex 13.1 Step 5 Displaying the output
321(1)
Ex 13.1 Step 6 Soft click
321(1)
Example 13.2 Joe's Security Emporium
321(8)
Ex 13.2 Step 1 The program operation
323(3)
Ex 13.2 Step 2 Procedures or functions?
326(1)
Ex 13.2 Step 3 Enhancing the If statements
327(1)
Ex 13.2 Step 4 The 'with object do ...' construct
328(1)
Example 13.3 Henry's 'Horse Heaven' Farm
329(5)
Ex 13.3 Step 1 Changes to the form
330(1)
Ex 13.3 Step 2 Changing the code
330(2)
Ex 13.3 Step 3 Comments on each subroutine
332(1)
Ex 13.3 Step 4 Alternative implementations
333(1)
Differences between functions and procedures
333(1)
Example 13.4 Nested function calls
334(1)
Example 13.5 Exception handling
335(1)
Example 13.6 Raising our own exceptions
336(1)
REVIEW
337(1)
IMPORTANT CONCEPTS
337(2)
NEW DELPHI FEATURES
339(1)
PROBLEMS
340(3)
14 The integrated debugger 343(12)
PURPOSE OF THIS CHAPTER
Preliminary
344(1)
Example 14.1 Breakpoints and tracing
344(3)
Ex 14.1 Step 1 btnParSec's OnClick handler
345(1)
Ex 14.1 Step 2 Setting breakpoints
345(2)
Example 14.2 Procedure calls and Watches
347(6)
Ex 14.2 Step 1 Introducing a procedure
348(1)
Ex 14.2 Step 2 Tracing flow to a procedure and back
349(1)
Ex 14.2 Step 3 Setting the Watch List
350(1)
Ex 14.2 Step 4 Tracing into, stepping over, and other niceties
350(1)
Ex 14.2 Step 5 Value and variable parameters
351(1)
Ex 14.2 Step 6 Parameter order
352(1)
Additional Debug features
353(1)
REVIEW
353(1)
IMPORTANT CONCEPTS
354(1)
NEW DELPHI FEATURES
354(1)
15 Simple databases in Delphi 355(37)
PURPOSE OF THIS CHAPTER
What is a database?
356(1)
Delphi's alternatives in terms of data access
356(1)
Creating and using database tables in Delphi
357(1)
Example 15.1 Creating a database containing one table
357(6)
Ex 15.1 Step 1 Creating a directory for the database
357(1)
Ex 15.1 Step 2 Creating the database
357(2)
Ex 15.1 Step 3 Creating the table
359(1)
What is a key?
360(3)
Ex 15.1 Step 4 The other fields
361(1)
Ex 15.1 Step 5 Changing the structure of a data table
362(1)
Handling database errors
363(1)
Example 15.2 Creating an application to add data to the Address table
363(4)
Ex 15.2 Bringing the database and the application together
365(1)
Ex 15.2 The Table component
365(1)
Ex 15.2 The DataSource component
365(1)
Ex 15.2 The DBGrid data control
366(1)
Ex 15.2 DBGrid:-viewing or updating only some fields
366(1)
Example 15.3 Using the DBEdit and DBNavigator data controls
367(2)
Ex 15.3 The DBEdit data control
368(1)
Ex 15.3 The DBNavigator data control
369(1)
Example 15.4 Creating a database application for holiday accommodation
369(6)
Ex 15.4 Step 1 Create the Kruger National Park database
371(1)
Ex 15.4 Step 2 Create the Camps data table
371(1)
Ex 15.4 Step 3 Create the GuestHouses data table
372(1)
Ex 15.4 Step 4 The application
372(3)
Example 15.5 The relationship between the two tables
375(3)
Referential integrity
375(2)
Ex 15.5 Step 1 Establishing referential integrity between the Camps and GuestHouses tables
376(1)
Ex 15.5 Step 2 The effect of the referential integrity
377(1)
Adding a guest-house record with an invalid CampName field
377(1)
Deleting Berg-en-dal camp
377(1)
Ex 15.5 Step 3 Guidelines for setting referential integrity
378(1)
Example 15.6 Using a DBLookupComboBox
378(2)
The DBLookupComboBox
379(1)
Example 15.7 Finding a record using a DBLookupComboBox
380(2)
Using a DBLookupComboBox without updating a field
381(1)
Example 15.8 Using a DBComboBox for the camp type
382(1)
The DBComboBox
383(1)
Example 15.9 The Database Form Wizard
383(3)
REVIEW
386(1)
IMPORTANT CONCEPTS
386(1)
NEW DELPHI FEATURES
387(2)
PROBLEMS
389(3)
16 Database programming using data modules and multiple forms 392(34)
PURPOSE OF THIS CHAPTER
Example 16.1 Maintaining the database: using a data module and multiple forms
393(11)
Ex 16.1 Step 1 Creating the application's main form
394(1)
Ex 16.1 Step 2 Creating a data module to contain the tables
395(1)
Using a data module
396(1)
Multiple forms and units in an application
396(6)
Ex 16.1 Step 3 Creating the Maintain camps table form
397(1)
Ex 16.1 Step 4 Making unit KNPDatModu accessible from MaintainCampsu
397(1)
Ex 16.1 Step 5 Creating the user interface for maintaining the Camps data table
398(1)
Ex 16.1 Step 6 Making unit MaintainCampsu accessible from the main form (frmKNP)
398(1)
Ex 16.1 Step 7 Adding code to show the Maintain camps table form
399(1)
Ex 16.1 Step 8 Adding the GuestHouses table to the data module
399(1)
Ex 16.1 Step 9 Creating a new form for maintaining the GuestHouses table
400(1)
Ex 16.1 Step 10 Making the data module accessible from the new form
400(1)
Ex 16.1 Step 11 Creating the user interface for maintaining the GuestHouses table
400(1)
Ex 16.1 Step 12 Making unit MaintainGH accessible from frmKNP
401(1)
Ex 16.1 Step 13 Adding code to show the Maintain guest-houses table form
401(1)
Showing forms: modal and modeless
402(1)
Making a unit accessible using File Use Unit
402(1)
What if we do not add the uses clause?
403(1)
Example 16.2 Reservations: adding and deleting records using program code
404(15)
Clicking the New menu item
404(1)
What does a reservation involve?
405(1)
How do we know that a guest-house is available for a specific week?
405(2)
Ex 16.2 Step 1 Creating the Reservations table
406(1)
Ex 16.2 Step 2 Adding the Reservations table to data module KNPDatModu
406(1)
Ex 16.2 Step 3 Creating the Reservations form
407(1)
The DateTimePicker
407(4)
Ex 16.2 Step 4 Creating the form for capturing the tourist information
407(1)
Ex 16.2 Step 5 Making unit TouristInfou accessible from Reservationu
408(1)
Ex 16.2 Step 6 Getting the logic right for the OnClick event handler of the Available? button
408(1)
Ex 16.2 Step 7 Making sure the user enters all the information needed
409(1)
Ex 16.2 Step 8 Making sure the week begins on a Monday
410(1)
DayOfWeek function
411(1)
Ex 16.2 Step 9 Finding the record in the Reservations table
411(1)
Searching for a specific record using FindKey
412(1)
Ex 16.2 Step 10 Getting the tourist information
412(1)
Setting component properties on another form
413(1)
ShowModal's ModalResult: did the user click on OK or Cancel?
413(1)
Ex 16.2 Step 11 OK and Cancel on frmTouristInfo
413(1)
The ModalResult property
414(1)
Ex 16.2 Step 12 Adding a new record to the Reservations table
415(1)
Inserting a new record
415(1)
Referring to fields
416(3)
Ex 16.2 Step 13 Calling the AddReservationRecord procedure
417(1)
Ex 16.2 Step 14 Adding code to show the Reservations form
418(1)
Example 16.3 Cancelling a reservation
419(3)
Ex 16.3 Specifying more than one ListField value for the DBLookupComboBox
420(1)
Ex 16.3 Deleting a record
421(1)
The application now
421(1)
Exception handling
421(1)
REVIEW
422(1)
IMPORTANT CONCEPTS
422(1)
NEW DELPHI FEATURES
423(2)
PROBLEMS
425(1)
17 Reporting 426(21)
PURPOSE OF THIS CHAPTER
Example 17.1 Selecting records using the Table component's Filter property
427(4)
Ex 17.1 Step 1 Initial user interface
427(1)
Ex 17.1 Step 2 Using the Filter and Filtered properties
428(1)
Filter and Filtered properties
429(1)
Changing the Filter property programmatically
429(1)
Ex 17.1 Step 3 Changing the user interface
429(1)
Ex 17.1 Step 4 Setting the Filter programmatically
430(1)
Setting the Filter property during run time
430(1)
Example 17.2 Generating the reservation reports
431(11)
'All Reservations' Report
433(1)
'Reservations for a specific guest-house' report
433(1)
'Reservations for a specific week' report
433(1)
Ex 17.2 Step 1 Form showing the reservation report options
433(1)
Making the form frmReservationReps accessible from the main form
434(1)
Ex 17.2 Step 2 Event handler for the Reporting | Reservations menu sequence
434(1)
Ex 17.2 Step 3 Create a new form for the layout of the reports
434(1)
Making the data module accessible to the report layout form
434(1)
Ex 17.2 Step 4 Using the QuickRep component
435(1)
The QuickRep component
435(1)
Ex 17.2 Step 5 Add Title, ColumnHeader and Detail bands to component QuickRepl
435(1)
Ex 17.2 Step 6 Design the Title band
436(1)
Resizing bands
436(1)
Ex 17.2 Step 7 Design the ColumnHeader band
436(1)
Ex 17.2 Step 8 Design the Detail band
437(1)
Different band types
437(1)
QRLabel and QRDBText components
438(1)
Ex 17.2 Step 9 Add a footer to the report
438(1)
QRSysData printable component
439(1)
Ex 17.2 Step 10 Making the report layout form accessible from unit ReservationRepsu
439(1)
Ex 17.2 Step 11 Preview and Print event handlers
439(1)
Using one QuickRep component
439(3)
Ex 17.2 Step 12 Using the OnFilterRecord event handler
440(1)
Ex 17.2 Step 13 A procedure to set the headings and to enable filtering
441(1)
Ex 17.2 Step 14 change the Print and Preview event handlers
441(1)
OnFilterRecord event handler
442(1)
REVIEW
442(1)
IMPORTANT CONCEPTS
443(1)
NEW DELPHI FEATURES
443(3)
PROBLEMS
446(1)
18 Investigating objects 447(38)
PURPOSE OF THIS CHAPTER
Example 18.1 The basic 'unit' file
448(2)
The unit name
448(1)
The interface section
449(1)
The implementation section
449(1)
Example 18.2 Extending the basic application
450(2)
Changing the form's name
451(1)
Adding buttons
451(1)
Adding event handlers
452(1)
Example 18.3 Creating our own classes and objects
452(5)
Ex 18.3 Step 1 The overall framework
453(1)
Ex 18.3 Step 2 the TCounter class
454(1)
The Code Explorer
455(2)
Ex 18.3 Step 3 Using the object
456(1)
Example 18.4 Re-using and extending TCounter
457(12)
Ex 18.4 Step 1 Inheriting from TCounter
458(1)
A comment on re-using existing units
458(5)
Ex 18.4 Step 2 Using the new class
460(3)
Navigating through the Code Explorer
463(1)
The Project Browser
464(1)
Simple object orientation
465(1)
Basic object-orientation principles
465(1)
Classes and objects
465(1)
Encapsulation
466(1)
Efficient, reliability and re-use through inheritance
467(1)
Composition - combining objects
468(1)
Polymorphism
469(1)
Example 18.5 The Sender parameter in event handlers
469(6)
Ex 18.5 Step 1 Static design (user interface)
469(2)
Ex 18.5 Step 2 The OnClick event handler, version 1
471(1)
Ex 18.5 Step 3 Using the Sender parameter
471(1)
Ex 18.5 Step 4 Linking in the other SpeedButtons
472(1)
Ex 18.5 Step 5 Testing the Sender parameter
472(1)
Ex 18.5 Step 6 Working through an ancestor (substitution)
473(1)
Ex 18.5 Step 7 An alternative typecasting operator
474(1)
Ex 18.5 Step 8 The equality operator
474(1)
Example 18.6 Converting a general procedure to a method
475(1)
REVIEW
476(1)
IMPORTANT CONCEPTS
477(2)
NEW DELPHI FEATURES
479(1)
PROBLEMS
479(6)
Appendices
Appendix 1 Deployment
485(3)
Appendix 2 File types
488(3)
Appendix 3 Component naming conventions
491(1)
Appendix 4 Internet programming
492(20)
Appendix 5 SQL queries
512(9)
Index 521