Class XbpPrintDialog() Foundation

Class function of the XbpPrintDialog class.

Superclass
Description

Objects of the XbpPrintDialog class are used to configure printers and print jobs within an Xbase++ applications. It implements the functionality to display a modal dialog window that enables the user to configure a print job's properties, such as the printer to print on or whether collation is to be used when printing.

Class methods
:new()
Creates an instance of the XbpPrintDialog class.
Life cycle
:create()
Requests system resources for an XbpPrintDialog object.
:configure()
Reconfigures the XbpPrintDialog object after :create() has been executed.
:destroy()
Releases the system resources of the XbpPrintDialog object.
Configuration
:enableCollate
Enables the collation option.
:enableMark
Enables the "Print marked range" option.
:enableNumCopies
Enables the "Number of Copies" option.
:enablePrintToFile
Enables the "Print to File" option.
:mode
Defines the mode to display the dialog in.
:pageRange
Defines the range of pages to be printed.
:printerClass
The class of the printer object returned by :display().
Configuration and results

Instance variables in this group serve two purposes: they configure certain options before the printer dialog window is displayed and receive the result of what a user has selected when the window is closed.

:collate
Use collation when printing.
:numCopies
Specifies the number of copies to print.
:pageRangeSelected
Specifies the range of pages to print selected by the user.
:printRange
Defines the range of pages to print.
:printToFile
Indicates if output is re-directed to a file.
Methods
:display()
Displays the printer dialog window and configures an XbpPrinter object.
Examples
Configuring a print job

// The example demonstrates the steps required for 
// print job configuration. 

 #include "Gra.ch" 
 #include "Xbp.ch" 

 #pragma Library( "XppUI2.lib" ) 

 PROCEDURE Main 
    LOCAL oPrinter, oPS, oDlg, aSize 

    oDlg := XbpPrintDialog():new() 

    // Default output goes to file 
    oDlg:enablePrintToFile := .T. 
    oDlg:printToFile       := .T. 
    oDlg:create() 

    // Obtain configured printer object 
    oPrinter := oDlg:display() 
    oDlg:destroy() 

    IF oPrinter <> NIL 
       // Create a new presentation space 
       oPS   := XbpPresSpace():new() 

       // Size of printable region on paper 
       aSize := oPrinter:paperSize() 
       aSize := { aSize[5] - aSize[3], ; 
                  aSize[6] - aSize[4]  } 
       oPS:create( oPrinter, aSize, GRA_PU_LOMETRIC ) 

       // Tiny print job 
       oPrinter:startDoc() 
       GraStringAt( oPS, { 0, aSize[2]-50 }, "Hello World" ) 
       oPrinter:endDoc() 

       // Housekeeping 
       oPrinter:destroy() 
       oPS:destroy() 
    ENDIF 
 RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.