Important: The information in this document is obsolete and should not be used for new development.
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 theDoMenuCommand
method of the print handler for the view to be printed or by theDoMenuCommand
method of aTPrintMenuBehavior
object attached to the view's document. Both of theseDoMenuCommand
methods call theDoPrintCommand
method of the print-handler object. In theTStdPrintHandler
class, theDoPrintCommand
method handles Print commands as follows:
Figure 23-1 Printing classes and methods
- Has the command constant
cPrint
. The print handler creates and posts aTPrintCommand
object. TheDoIt
method of the command object calls the print handler'sPoseJobDialog
method to display the print dialog box and prepare for printing. If the user clicks OK, theDoIt
method calls the print handler'sTPrintCommand
object makes the printing operation recordable but not undoable.
The
- Print One
- Has the command constant
cPrintOne
. The print handler creates and posts aTPrintCommand
object. TheDoIt
method of the command object does not display a print dialog--instead it calls the print handler'sSetupPrintOne
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- Page Setup
- Has the command constant
cPageSetup
. The print handler calls its ownPosePageSetupDialog
method to display the page setup dialog box. If the user clicks OK, the print handler creates aTPrintStyleChangeCommand
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 itsfShowBreaks
instance variable and calls its ownInvalPageFeedback
method to force redrawing of the view so that page breaks are shown or not shown, as specified.DoPrintCommand
method also handles thecFinderPrint
andcDragPrint
command constants:
- Finder printing
- For
cFinderPrint
, the print handler calls its ownSetupForFinder
method to prepare for printing, then calls its own- Drag printing
- The
cDragPrint
command is handled similarly to the Print One command. The print handler first callsSetupPrintOne
, then calls its own