home *** CD-ROM | disk | FTP | other *** search
- //
- // Module Name: AS_PRIN.COD
- // Description: Procedure for toggling printer output
- // Notes : Written for dBASE IV
- //
- PROCEDURE PrintSet
- *{replicate("-",69)}
- * Procedure for toggling printer output
- *{replicate("-",69)}
- PRIVATE lc_window
-
- gc_dev='CON'
- lc_choice=' '
- gn_pkey=0
- gn_send=3
-
- DEFINE WINDOW printemp FROM 08,25 TO 17,56
-
- DEFINE POPUP SavePrin FROM 10,40
- DEFINE BAR 1 OF SavePrin PROMPT " Send output to ..." SKIP
- DEFINE BAR 2 OF SavePrin PROMPT REPLICATE(CHR(196),24) SKIP
- DEFINE BAR 3 OF SavePrin PROMPT " CON: Console" MESSAGE "Send output to Screen"
- DEFINE BAR 4 OF SavePrin PROMPT " LPT1: Parallel port 1 " MESSAGE "Send output to LPT1:"
- DEFINE BAR 5 OF SavePrin PROMPT " LPT2: Parallel port 2" MESSAGE "Send output to LPT2:"
- DEFINE BAR 6 OF SavePrin PROMPT " COM1: Serial port 1" MESSAGE "Send output to COM1:"
- DEFINE BAR 7 OF SavePrin PROMPT " FILE = REPORT.TXT" MESSAGE "Send output to File Report.txt"
- ON SELECTION POPUP SavePrin DEACTIVATE POPUP
-
- lc_window = WINDOW(){tabto(41)}&& Capture current window name
- IF .NOT. ISBLANK( lc_window ){tabto(41)}&& If window was active
- ACTIVATE SCREEN{tabto(41)}&& Activate screen for correct popup posit
- ENDIF
-
- ACTIVATE POPUP SavePrin
- gn_send = BAR()
- RELEASE POPUP SavePrin
-
- IF .NOT. ISBLANK( lc_window ){tabto(41)}&& If window was active before
- ACTIVATE WINDOW &lc_window.{tabto(41)}&& Reactivate it
- ENDIF
-
- IF gn_send <> 0{tabto(41)}&& If user madde a popup selection
-
- IF gn_send = 7{tabto(41)}&& Output to file
- gc_dev = 'TXT'
- SET ALTERNATE TO REPORT.TXT
- SET ALTERNATE ON
- ELSE
- IF gn_send <> 3{tabto(41)}&& Output not to the screen
- gc_dev = 'PRN'
- ON ERROR DO prntrtry
- DO CASE
- CASE gn_send = 4
- SET PRINTER TO LPT1
- CASE gn_send = 5
- SET PRINTER TO LPT2
- CASE gn_send = 6
- SET PRINTER TO COM1
- ENDCASE
- SET PRINT ON
- ON ERROR
- ENDIF
- ENDIF
-
- ELSE
- gn_pkey = 27{tabto(41)}&& Signal escape pressed to caller
- ENDIF
-
- RELEASE WINDOW printemp
-
- RETURN
- *-- EOP: PrintSet
-
- PROCEDURE PrntRtry
- *{replicate("-",69)}
- * On error routine for handling printer errors.
- *{replicate("-",69)}
- PRIVATE ll_escape
- ll_escape = SET("ESCAPE") = "ON"
-
- IF .NOT. PRINTSTATUS(){tabto(41)}&& If printer not ready
-
- IF ll_escape{tabto(41)}&& If Escape on, set it off
- SET ESCAPE OFF
- ENDIF
-
- ACTIVATE WINDOW printemp
- @ 1,0 SAY "Please ready your printer or"
- @ 2,0 SAY " press ESC to cancel"
-
- *-- Loop until printer is ready or user presses escape
- gn_pkey = 0
- DO WHILE ( .NOT. PRINTSTATUS()) .AND. gn_pkey <> 27
- gn_pkey = INKEY()
- ENDDO
-
- DEACTIVATE WINDOW printemp
- IF ll_escape
- SET ESCAPE ON
- ENDIF
-
- IF gn_pkey <> 27{tabto(41)}&& If user wants to retry
- RETRY{tabto(41)}&& Retry the print command
- ENDIF
-
- ENDIF
-
- RETURN
- *-- EOP: PrntRtry
- // EOP AS_PRIN.COD
-