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


Chapter 3
AppointmentBook

The AppointmentBook application tracks meetings and appointments. The user enters information about an appointment, and AppointmentBook presents a reminder message when the time for the appointment draws near.

The first section in this chapter, “Using AppointmentBook,” describes the program’s key features from the user’s point-of-view. It explains how the user enters, modifies, and deletes appointment information. It also describes the application’s HTML help system. This help system provides an alternative to the compiled help used by the ExpenseReporter application.

Note that the help system is implemented using the WebBrowser control provided with Visual Basic 5.0. Since it uses the WebBrowser control, the program will not work with earlier versions of Visual Basic. If you are using an earlier version, you may still want to read about the techniques described in this chapter, but you will be unable to run AppointmentBook as it is written.

The next section, “Key Techniques,” briefly lists the most important Visual Basic programming methods used to implement AppointmentBook. The rest of the chapter describes these techniques in detail.

Using AppointmentBook

Before reading about how AppointmentBook was designed and coded, take a few minutes to run the program and test some of its features. The section “Using the Compact Disk” in the Introduction explains how you can load the program’s source files from the compact disk. AppointmentBook is contained in the ApptBook.VBP project in the Ch3 directory.

AppointmentBook reads and writes appointment data to the file Appts.DAT. Because there is no way to know when you will run the program, Appts.DAT is not included in the Ch3 directory. The first time you run the program, AppointmentBook will tell you it cannot find Appts.DAT, and it will ask if it should create a new data file. Press the Yes button, and the program will be ready to run.

Figure 3.1 shows the AppointmentBook application in action. The following sections describe AppointmentBook’s features from the user’s point-of-view.

Selecting Dates

AppointmentBook has two main display areas: the month area on the left and the daily appointment area on the right.

The month area highlights dates that hold appointments by giving them a slightly darker background color. The months are labeled vertically to save space on the screen. Adjacent months have different background colors so it is easy to see where one month ends and the next begins.

When the user clicks on the month area to select a date, the program displays the selected date with white text on a black background. In Figure 3.1 April 1 is the selected date.

The month area’s scroll bar allows the user to move the calendar forward and backward through time. By clicking on the scroll bar’s up and down arrows, the user can move the selected date by one week. Clicking between the scroll bar’s slider and one of its arrows moves the selected date by four weeks.

By dragging the slider, the user can move the selected date by many weeks at a time. The month area is relatively slow to draw, so it is not redrawn until the user finishes dragging the slider. The date label above the daily appointment area shows the date the user is selecting as the slider is dragged.


FIGURE 3.1  The AppointmentBook application.

AppointmentBook also allows the user to change the selected date using the arrow keys. When the user presses an arrow key, the program selects the corresponding adjacent date. For instance, if the user presses the up arrow, the program moves the selected date to one week earlier.

If the user holds down the shift key and presses the up or down arrow, the program moves the selected date by four weeks. If the user holds down the shift key and presses the left or right arrow, the program moves the selected date to the previous Sunday or next Saturday.

The Select Today command in the Appointments menu allows the user to select the current date easily. At first this function may seem unnecessary because the user can select the current date using the month area’s scroll bar. However, the month area contains a lot of dates. It displays the current year and the previous and next years, for a total of almost 1100 days. Finding today’s date using the scroll bar can be difficult. Because a user will often want to create appointments near the current date, it makes sense to create a special function to select that date.

Viewing Appointments

The daily appointment area shows the appointments for the date selected in the month area. The label above the appointment area shows the selected date textually. This label is important because it displays the selected date’s year; the month area does not.

The daily appointment area shows text describing the appointments on the selected date. Morning appointments are shown with lighter background colors than appointments in the afternoon.

The text describing an appointment is displayed in a multiline text box, which allows the user to highlight the text and use Ctrl-C to copy it to the clipboard. The user can then use Ctrl-V to paste the text into other applications.

The appointment area’s scroll bar allows the user to examine all of the appointments on the selected date. When the user selects a new date, the appointment area scrolls to show the date’s first appointment.

Creating Appointments

To create a new appointment entry, the user should first select the appointment’s date. When the user selects the New Appointment command from the Appointment’s menu, the dialog shown in Figure 3.2 appears. The user should enter the appointment’s Start and Stop Times, the Warning time, and a brief message describing the appointment. When the user clicks the OK button, AppointmentBook creates the appointment entry.

The warning time indicates when AppointmentBook should remind the user of the appointment. For example, if the appointment is scheduled for 9:00 AM and the warning time is 30 minutes, the program will remind the user of the appointment at 8:30 AM. Figure 3.3 shows a typical reminder message.

Modifying or Deleting Appointments

To modify or delete an appointment, the user should select the appointment’s date and double-click on the appointment’s text in the daily appointment area. The program will display a dialog similar to the one shown in Figure 3.2, used to create a new appointment. To modify the appointment, the user should make the required changes and click the OK button. To delete the appointment, the user should click the Delete button.


FIGURE 3.2  The appointment editing dialog.


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.