Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : SYSTEM-DIALOG PRINTER-SETUP statement
 

SYSTEM-DIALOG PRINTER-SETUP statement

(Windows only)
Displays the Windows Print dialog box and lets the user set the default print context for subsequent print jobs in Windows.
Note: Does not apply to SpeedScript programming.

Syntax

SYSTEM-DIALOG PRINTER-SETUP
[ NUM-COPIES expression ]
[ LANDSCAPE | PORTRAIT ]
[ UPDATE status ]
[ IN WINDOW window ]
NUM-COPIES expression
Specifies the initial value of the Copies field in the Print dialog box. The value expression must evaluate to an integer expression. The user can change this value within the dialog box. This option is supported only with printer drivers that support multi-copy printing. Otherwise, the Copies field is disabled.
LANDSCAPE
Specifies the initial value of the Orientation field in the Properties dialog box as landscape. The user can change this value within the dialog box. The Properties dialog box is accessible from the Print dialog box. This option is supported only with printer drivers that support landscape page orientation.
PORTRAIT
Specifies the initial value of the Orientation field in the Properties dialog box as portrait. The user can change this value within the dialog box. The Properties dialog box is accessible from the Print dialog box. This option is supported only with printer drivers that support portrait page orientation.
UPDATE status
Specifies a logical variable to return the status of the user's dialog interaction. If the user chooses the OK button, the dialog sets status to TRUE. If the user chooses the Cancel button, the dialog sets status to FALSE.
IN WINDOW window
Specifies the window from which the Print dialog box is displayed. The value window must be the handle of a window.

Example

This example presents a dialog box that allows you to set up and print information from the sports database. When you choose the Printer Setup button, it displays the Windows Print dialog box. Using the latest settings, you can then print a list of customer names from the sports database in alphabetical order by choosing the Print Customer Names button.
r-prtdlg.p
DEFINE BUTTON bprintset   LABEL "Printer Setup".
DEFINE BUTTON bprintnames LABEL "Print Customer Names".
DEFINE BUTTON bcancel     LABEL "Cancel".

DEFINE FRAME PrintFrame
  bprintset bprintnames bcancel
  WITH TITLE "Quick Printer" VIEW-AS DIALOG-BOX.

ON CHOOSE OF bprintset DO:
  SYSTEM-DIALOG PRINTER-SETUP.
END.

ON CHOOSE OF bprintnames DO:
  OUTPUT TO PRINTER.
  FOR EACH Customer NO-LOCK BY Customer.Name:
    DISPLAY Customer.Name WITH STREAM-IO.
  END.
  OUTPUT CLOSE.
END.

ENABLE ALL WITH FRAME PrintFrame.
WAIT-FOR CHOOSE OF bcancel IN FRAME PrintFrame.

Notes

*The default print context is the set of values that defines the default printer and setup for that printer in Windows. If there is no default print context, the AVM uses the printer control settings from the current environment.
*Use the PRINTER-NAME attribute of the SESSION system handle to set the printer name in the default print context without user intervention.
*By default, the OUTPUT TO PRINTER statement prints jobs based on the default print context. However, you can use the OUTPUT TO PRINTER statement with its various options to override the default print context for a specific print job.

See also

OUTPUT TO statement, SESSION system handle