Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Programmer's Guide to MacApp / Part 2 - Working With MacApp
Chapter 23 - Working With Printing


Handling Print Menu Commands

Human interface guidelines specify that all Print commands be included in the File menu. MacApp defines command constants for the Print, Print One, Page Setup, and Show Breaks menu commands. These command constants are handled by the DoMenuCommand method of the print handler for the view to be printed or by the DoMenuCommand method of a TPrintMenuBehavior object attached to the view's document. Both of these DoMenuCommand methods call the DoPrintCommand method of the print-handler object. In the TStdPrintHandler class, the DoPrintCommand method handles Print commands as follows:

Print
Has the command constant cPrint. The print handler creates and posts a TPrintCommand object. The DoIt method of the command object calls the print handler's PoseJobDialog method to display the print dialog box and prepare for printing. If the user clicks OK, the DoIt method calls the print handler's Print method to perform printing. The TPrintCommand object makes the printing operation recordable but not undoable.
Figure 23-1 Printing classes and methods

Print One
Has the command constant cPrintOne. The print handler creates and posts a TPrintCommand object. The DoIt method of the command object does not display a print dialog--instead it calls the print handler's SetupPrintOne method to validate the print record and set the first page to 1 and the last page to 9999. Then it calls the print handler's Print method to perform printing.
Page Setup
Has the command constant cPageSetup. The print handler calls its own PosePageSetupDialog method to display the page setup dialog box. If the user clicks OK, the print handler creates a TPrintStyleChangeCommand object and posts it to the command queue; the command object makes page setup changes undoable.
Show Breaks
Has the command constant cShowBreaks. The print handler toggles the value of its fShowBreaks instance variable and calls its own InvalPageFeedback method to force redrawing of the view so that page breaks are shown or not shown, as specified.
The DoPrintCommand method also handles the cFinderPrint and cDragPrint command constants:

Finder printing
For cFinderPrint, the print handler calls its own SetupForFinder method to prepare for printing, then calls its own Print method to do the printing.
Drag printing
The cDragPrint command is handled similarly to the Print One command. The print handler first calls SetupPrintOne, then calls its own Print method to do the printing.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
25 JUL 1996