C5_SETPRC

 SETPRC()
 Set PROW() and PCOL() values
------------------------------------------------------------------------------
 Syntax

     SETPRC(<nRow>, <nCol>) --> NIL

 Arguments

     <nRow> is the new PROW() value.

     <nCol> is the new PCOL() value.

 Returns

     SETPRC() always returns NIL.

 Description

     SETPRC() is a printer function that sends control codes to the printer
     without changing the tracking of the printhead position.  When
     Clipper prints, it updates the PCOL() value with the number of
     characters sent to the printer.  There is no discrimination between
     printable or nonprintable characters.  If, for example, a string of ten
     characters sent to the printer contains two characters interpreted by
     the printer as a control code, the Clipper PCOL() value is
     incremented by ten, while the true printhead position is moved only by
     eight.  This can lead to alignment problems.  Using SETPRC(), you can
     compensate for control codes by resetting PCOL() as shown in the example
     below.

     SETPRC() also suppresses page ejects when printing with @...SAY.  This
     is important when the next row position is smaller than the current row
     and an EJECT has not been issued.  In this situation, CA-Clipper issues
     an automatic page eject if the next row print position is less than the
     current PROW() value.  Using SETPRC(), you can set PROW() to a number
     less than the current row, thus suppressing the automatic EJECT.

 Examples

     .  This user-defined function, PrintCodes(), uses SETPRC() to
        send control codes to the printer without affecting PROW() and PCOL()
        values:

        #include "Set.ch"
        #define ITALICS_ON   CHR(27) + "I"
        #define ITALICS_OFF   CHR(27) + "E"
        //
        SET DEVICE TO PRINTER
        @ 12, 10 SAY "This is an"
        @ PROW(), PCOL() + 2 SAY PrintCodes(ITALICS_ON) + ;
                 "important"
        @ PROW(), PCOL() + 2 SAY PrintCodes(ITALICS_OFF) + ;
                 "meeting"
        SET DEVICE TO SCREEN
        RETURN

        FUNCTION PrintCodes( cCtrlCode )
           LOCAL nRow, nCol, lPrinter
           lPrinter := SET(_SET_PRINTER, .T.)    // SET PRINTER ON
           nRow:= PROW()                         // Save printhead position
           nCol:= PCOL()
           //
           ?? cCtrlCode                          // Send control code
           //
           SETPRC(nRow, nCol)
           SET(_SET_PRINTER, lPrinter)           // Restore printer setting
           RETURN ""                             // Return a null string

 Files   Library is CLIPPER.LIB.

See Also: PCOL() PROW() SET DEVICE SET()



One response to “C5_SETPRC

  1. Pingback: C5_SET PRINTER | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.