Lab 3

Handed out: 11/4

Due: 12/9

This final lab builds upon your address book program. We will introduce a menu bar with 2 menus, File and Help. It should look like the following:

The application still accepts a command line parameter (an address book to use).

  1. If the address book indicated by the command line parameter exists, use it.
  2. If the address book does not exist, present a dialog asking, "Filename does not exist. Create It?" where the name they entered is substituted for the word Filename in the text.
    1. If Yes, pop down the dialog and create the address book and use it.
    2. If no is selected, pop down the dialog, but leave the main window up. Any operations they do will occur against a newly created address book. They will need to use Save As to save the book out to a new file.
  1. If no address book is provided on the command line, any operations they do will occur against a newly created address book. They will need to use Save As to save the book out to a new file.

The File menu shall have the following options:

  1. New - Clear out any currently loaded address book data. If there is any unsaved data, destroy it and clear out the scrolled list of names.
  2. Open - Present the FileSelectionDialog for address book selection. When the user selects an address book, load the address book into memory and populate the scrolled list. If the user has made changes to an existing book in memory, the changes will be lost.
  3. Save - Save the current address book out to the current file name
  4. Save As - Display a prompt dialog asking for the file name to which the address book should be saved.
  5. Exit - Exit the application

The Help drop down menu should have 1 option, Application Help. When selected, a dialog box should pop up with a brief description of how to use the application.

The Menu bar should be the MenuBar child of the MainWindow of your lab.

The help dropdown menu should be stuck to the right side of the main window.

Extra Credit (5 points on the lab)

Attached is the header file (called c_if.h) which contains all of the address book functions you should need, a sample program which uses the interface to the address book utilities, as well as the format of the data file. I recommend you compile the application using the standard course makefile, which you can modify if needed.

Please submit this lab to me using the normal Lab Submission Instructions.

Left Go back to Assignments