home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 15.21. Printer error handling function.
- Author: Craig Yellick
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
-
- function PrintError(r, c, err, passAlong)
- /*
- Error handler used during printing.
-
- r Row to display messages.
- c Column to display messages.
- err Error object to handle.
- passAlong Handler to pass error object along to
- if this handler can't deal with it.
- */
- #include "ERROR.CH"
- local tryAgain
-
- // If generic code indicates a printer error
- if err:genCode = EG_PRINT
-
- /*
- Display informative message and wait for either
- the printer to come back on-line or a keystroke.
- */
- set device to screen
- @ r, c clear to r +2, maxCol()
- @ r, c say "Printer Error!"
- @ r +1, c say ;
- "Possible problems: Out of paper, jammed, off-line."
- @ r +2, c say ;
- "Attempt to fix problem. Press any key to continue."
- keyboard ""
- do while .not. (isprinter() .or. inkey() <> 0)
- enddo
-
- /*
- If the printer comes back, ask if they want to resume.
- */
- @ r, c clear to r +2, maxCol()
- if isprinter()
- @ r, c say "Printer is back..."
- @ r +1, c say "Do you want to resume printing the report?"
- @ r +2, c say ;
- "Press Y to resume printing or any other key to cancel."
- keyboard ""
- tryAgain := (chr(inkey(0)) $ "Yy")
- @ r, c clear to r +2, maxCol()
- if tryAgain
- set device to printer
- return .t.
- endif
- endif
- break
-
- /*
- Some other kind of error occurred, pass the error
- along to the previous error handler.
- */
- else
- return eval(passAlong, err)
- endif
-
- return nil
-
- // end of file CHP1521.PRG
-