Skip to content

phPrintDlg - cDRReport

Methods - Properties - Events

Type

Handle

Default

0

Arguments

None

Description

This write-only property can be set to the address of a PrintDlgEx structure, which can be returned by an object of the cPrintDialog class. The value will be used by the OutputReport method and passed to the PrintReport method.

When the value of this property remains zero and psPrinterName is empty, the PrintReport method will query the printer.

Setting the property to an invalid handle might result in a system crash. Results are unknown.

Avoid that PrintDialog popups a dialog in a Web application.

For more information about the PRINTDLGEX structure, see: PRINTDLGEX Structure

DataFlex Framework usage

  • Web
  • Windows
  • FlexTron

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
    Set peOutputDestination to PRINT_TO_PRINTER
End_Object

Object oPrinterSelection Is A cPrintDialog
    Set pePaperSize to DMPAPER_A4
End_Object

Object oOutputReportButton is a Button
    Set Label to 'Output Report'

    Procedure OnClick
        Integer iResult
        Handle hPrintDlg

        Get PrintDialog Of oPrinterSelection to iResult
        If (iResult = PD_RESULT_PRINT) Begin
            Get phPrintDlg Of oPrinterSelection To hPrintDlg
            Set phPrintDlg Of oReport to hPrintDlg
        End
        Send RunReport Of oReport
    End_Procedure
End_Object

The above example can be simplified to:

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
    Set peOutputDestination to PRINT_TO_PRINTER
End_Object

Object oOutputReportButton is a Button
    Set Label to 'Output Report'

    Procedure OnClick
        Integer iResult
        Handle hoPrintDialog hPrintDlg

        Get phoPrintDialog Of oReport to hoPrintDialog
        Set pePaperSize Of hoPrintDialog to DMPAPER_A4
        Get PrintDialog of hoPrintDialog to iResult
        If (iResult = PD_RESULT_PRINT) Begin
            Get phPrintDlg Of hoPrintDialog To hPrintDlg
            Set phPrintDlg Of oReport to hPrintDlg
        End
        Send RunReport Of oReport
    End_Procedure
End_Object