![]() | |
|
|
|
To access the contents, click the chapter and section titles.
Advanced Visual Basic Techniques
Loading and Saving DataAppointmentBook 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 computers Reset button.
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 DataAppointmentBook 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 HelpAppointmentBook 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 URLHelpForms 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 AppointmentBooks 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 browsers 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 HelpThe 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 areas help topic. For instance, if the user clicks on the month areas scroll bar and presses F1, the help system displays help about the month area.
If no control with context-sensitive help is selected when the user presses F1, the help system presents AppointmentBooks help contents page. Viewing the About DialogLike 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 AppointmentBooks 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 SynchronizedDifferent 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:
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:
Keeping the different parts of the program synchronized is one of AppointmentBooks most important and complex features. Key TechniquesDespite 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, AppointmentBooks features are easy to understand. Even the elaborate user interface interactions can be broken into pieces that are simple enough to implement reliably.
|
|
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.
|