home account info subscribe login search FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Advanced Visual Basic Techniques
(Publisher: John Wiley & Sons, Inc.)
Author(s): Rod Stephens
ISBN: 0471188816
Publication Date: 06/01/97

Search this book:
 
Previous Table of Contents Next


Loading and Saving Data

AppointmentBook loads the data contained in the file Appts.DAT when it starts. Later, whenever appointment data changes, the program saves the updated data in Appts.DAT. Saving the data is very quick so this does not inconvenience the user. It also ensures that the data is safe at all times. This means the user can exit AppointmentBook without explicitly saving the data. The data is safe if the program crashes or if the user stops the program with the Task Manager or some other external method. The data is even safe if the computer halts unexpectedly due to a power failure or the user pressing the computer’s Reset button.


FIGURE 3.3  The appointment reminder dialog.

This feature is particularly important for a program such as AppointmentBook that may be running all the time. The system can start AppointmentBook when it boots. The user can shut down the computer without worrying about whether the AppointmentBook data is saved. This allows AppointmentBook to run continuously so it can display reminder messages whenever they are needed.

Purging Old Data

AppointmentBook displays past appointments so the user can review them. The user can flush the old data from the system by selecting the Purge command from the Appointments menu. Because removed data cannot be restored, the program asks the user to confirm the operation before it deletes the old data.

Displaying Help

AppointmentBook does not use a standard help system as does the ExpenseReporter application described in Chapters 1 and 2. Rather than using a compiled help file, AppointmentBook displays help using a collection of HTML (Hypertext Markup Language) documents similar to those displayed on the World Wide Web.

The constant HELP_DIR defined in the URLHelpForm’s declares section indicates the location of the help documents. In AppointmentBook this value is set to http://Beauty/HelpHTML/. You need to change this value to reflect the location of the documents on your system before you can test the help. The help files are in the Ch3\HelpHTML directory on the compact disk.

If the user selects the Contents command from the Help menu, the program displays the contents page shown in Figure 3.4. By clicking on the HTML links on this page, the user can navigate to other help topics.

If the user selects the Index command from AppointmentBook’s Help menu, the program displays the index page shown in Figure 3.5. The letters across the top of the page provide links to sections within the page. For example, if the user clicks the letter M, the browser will scroll down to display index entries that start with M.

By clicking on an index topic, the user can navigate to a help page that explains that topic. Figure 3.6 shows the help page describing the month area. Help pages such as this one can use any features supported by HTML including links to other topics and graphics.

AppointmentBook displays help documents in a customized browser form. The browser’s Navigate menu provides commands to display the help contents or the help index, return to the previously displayed help page, and refresh the current display. It also contains a list of the last 10 help pages it has displayed. If the user selects one of these pages, the browser quickly redisplays it.

Displaying Context-Sensitive Help

The user can obtain context-sensitive help by clicking on part of AppointmentBook and pressing F1. The month area, daily appointment area, and the appointment description text have their own help topics.

Context-sensitive help for the scroll bars leads to the corresponding area’s help topic. For instance, if the user clicks on the month area’s scroll bar and presses F1, the help system displays help about the month area.


FIGURE 3.4  The help contents page.

If no control with context-sensitive help is selected when the user presses F1, the help system presents AppointmentBook’s help contents page.

Viewing the About Dialog

Like ExpenseReporter, AppointmentBook displays a splash screen when it starts. If the user selects the About AppointmentBook command from the Help menu, the program uses the same screen to provide an about dialog giving version and copyright information. Figure 3.7 shows AppointmentBook’s about dialog. Its unusual shape makes it more eye-catching than the dialogs provided by ExpenseReporter and adds interest to an otherwise routine feature.

Keeping Pieces Synchronized

Different parts of AppointmentBook are tied closely to the data and to each other. A single function or change to the data may cause several changes to the visible display.

For example, suppose the user scrolls the month far into the future. If the user invokes the Select Today command from the Appointments menu, the program updates its display in five ways:

1.  The month area scrolls to show the current date and the dates immediately after it. It highlights the current date.


FIGURE 3.5  The help index page.

2.  The month area’s scroll bar adjusts to indicate the position of the current date within the larger calendar.
3.  The daily appointment area displays the appointments for the current date.
4.  The daily appointment area’s scroll bar adjusts to indicate the position of the displayed appointments within the daily schedule.
5.  The date label above the appointment area displays the current date.

Other simple actions also have complicated consequences. If the user creates a new appointment for a past date that did not have an appointment before, the program updates its display in three ways:


FIGURE 3.6  A help page describing the month area.

1.  The daily appointment area displays the new appointment information.
2.  The month area changes to display the date highlighted.
3.  The program presents a message indicating that the user missed the appointment because it is in the past.

Keeping the different parts of the program synchronized is one of AppointmentBook’s most important and complex features.

Key Techniques

Despite the apparent simplicity of its mission, AppointmentBook is a rather complex application. The interactions among the data and different parts of the user interface are particularly complicated. Taken individually, however, AppointmentBook’s features are easy to understand. Even the elaborate user interface interactions can be broken into pieces that are simple enough to implement reliably.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.