Kbase 15450: How to Use _osprint.p with 4GL
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Verified
GOAL:
How to Use _osprint.p
FIX:
_osprint.p is a procedure in the $DLC\src\adecomm directory in version 8, or in the adecomm.pl procedure library in version 9 and above. This is the procedure Progress uses to print from the procedure editor.
Following is code showing variable definition and trigger code for a button that prints a file.
NOTE: This sample prints the $DLC/version file. Just change the file-to-print variable to the file you would like to print.
/*--------------------------------------------------------------------*/ /* PrintExample.p */ /*--------------------------------------------------------------------*/ /* Local Variable Definitions */ DEFINE VARIABLE whand AS HANDLE NO-UNDO. DEFINE VARIABLE file-to-print AS CHARACTER NO-UNDO INITIAL "version". DEFINE VARIABLE p_FontNumber AS INTEGER NO-UNDO INITIAL 5. DEFINE VARIABLE p_UseDialog AS INTEGER NO-UNDO INITIAL 1. DEFINE VARIABLE p_PageSize AS INTEGER NO-UNDO INITIAL 20. DEFINE VARIABLE p_PageCount AS INTEGER NO-UNDO INITIAL 0. DEFINE VARIABLE p_Printed AS LOGICAL NO-UNDO. DEFINE FRAME frame-a. DEFINE BUTTON button-1 LABEL "Print". ENABLE button-1 WITH FRAME frame-a. ON CHOOSE OF button-1 IN FRAME FRAME-A DO: ASSIGN whand = CURRENT-WINDOW. RUN adecomm\_osprint.p (INPUT whand, INPUT file-to-print, INPUT p_FontNumber, INPUT p_UseDialog, INPUT p_PageSize, INPUT p_PageCount, OUTPUT p_Printed). IF p_Printed = TRUE THEN MESSAGE "Print successful!" VIEW-AS ALERT-BOX. ELSE MESSAGE "Print failed." VIEW-AS ALERT-BOX. END. WAIT-FOR "GO" OF FRAME frame-a.