Progress on Print Preview

With all the posting on tropical weather, you might think that I’m not taking the time to continue working on Print Preview and HUD-1. On the contrary, I have made quite steady day-to-day progress on the form. Significant parts of the form are complete and have been briefly tested. A lot of work needs to be finished, but the end is in sight.

The most visible change is the appearance of the form. I’ve placed all of the controls, assigned the onscreen help text, and set up the tab order and shortcut keys. And here it is:

printpreview-08242009

The procedural flow of the code is 100 percent settled, but there are still gaps. The code to handle form data in the Data Server and the Open From Form button must still be written, as well as the display, zoom and pan code. But the code to read and render from a file is done and tested. Also, the code to open a file or form from either Print Preview’s command line or the Open From File button is finished.

The biggest pieces of code that has yet to be even considered (IE, planned) is the DoubleClick code and the MouseMove code.

DoubleClick() will determine the field name (such as Line 235) the user just double-clicked upon, and either open a HUD-1 data entry form with the correct file (if the file is not already open in a data entry form) or shift the focus to the correct data entry form in HUD-1’s main window if the file is already open. The HUD-1 form will then jump to the wanted field, and select the text so that the user can instantly correct any errors.

MouseMove() will monitor the position of the mouse (in X, Y coordinates) over the rendered image, and display that coordinate on the form’s status bar. I might be able to add the name of the field, but that might take too much processor time.

The most significant code that is finished is contained in what I call the Render_Container class. This class has a method named Action(). In fact, every class in the Form Framework based on the CodeBase class has an Action() method. This is a throwaway method that presents a common interface to calling code and designers. If the class has one primary task, that task will be found in the Action() method.

In the case of Render_Container, Action() sets up all the contained objects (the data servers, the script generator, the rendering engine, a timer control and a GetFilename control) and controls the flow of execution between them, finally producing images for loading. Finally, Action() invokes the Bitmap_Load() method and waits for further input from the user.

All the code in Action() has been tested and it works fine. It correctly reports all errors and exits gracefully in case of a failure, and resets the form when finished so that the user can start a new rendering operation.

The form itself is capable of quite a lot:

  • Produce images representing the separate pages of a normally printed report so the user can check their data input;
  • Render an image from either an open data entry form or a file;
  • Check that a file is both a valid DBFINI file (a specific kind of FoxPro table file, designed to hold settings and data) and a HUD-1 centric file;
  • If opened from the HUD-1’s Print Dialog Box, PrintPreview will automatically render from the Dialog Box’s Current File field (which can be either a file or a passed data entry form name);
  • If opened from a HUD-1 data entry form, PrintPreview will automatically render from the data in the form;
  • If opened from the HUD-1 program’s main menu, PrintPreview will wait for the user to click either of the Open From buttons, and render;
  • Regardless of how PrintPreview is started, allow the user to render again and again until the form is closed;
  • Show the progress of reading, scripting and rendering operations and any errors through a status bar display;
  • Allow the user to zoom in and out, and pan up and down and left and right;
  • Allow the user to select distinct pages of a multi-page report with a combobox;
  • Respond to double clicks as explained above.

Comments are closed.