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()
Pingback: C5_SET PRINTER | Viva Clipper !