Function SetPrc() Foundation

Resets the internal counters of the functions PRow() and PCol().

Syntax
SetPrc( <nRow>, <nCol> ) --> NIL
Parameters
<nRow>
<nRow> is a positive integer which is assigned to the row counter of the function PRow().
<nCol>
<nCol> is a positive integer which is assigned to the column counter of the function PCol().
Return

The return value of SetPrc() is always NIL.

Description

The function SetPrc() redefines the counters in the two functions PRow() and PCol(). This is required when non-printable control characters are sent to the printer. These can be special characters which affect the font of the printer or those which cause a line feed. When control characters are sent to the printer there are differences between the current position of the print head and the internal counters of the functions PRow() and PCol(). These differences are corrected using SetPrc().

For example, when the print is changed to bold the corresponding control characters must be sent to it. These characters increment the counter from PCol(), but do not lead to output and consequently do not change the position of the print head. Since the control characters differ with different printer models, PCol() does not attempt to recognize any control characters but counts each character sent to the printer.

When the print output uses the command @...SAY, an EJECT automatically occurs as soon as the row position for the output is less than the row position of the last output. SetPrc() can be used to suppress this behavior if it sets the counters in PRow() to a new value which is less than the last row position.

Examples
SetPrc()
// The example shows the function PrintEscSequence(), 
// which uses SetPrc() to keep position of the print head 
// in agreement with PCol() when control characters are 
// output. 
// Control characters shown are Epson escape codes. 

PROCEDURE Main 

   SET DEVICE TO PRINTER 

   @ 0,0 SAY "Normal text" 

   PrintEscSequence( Chr(27)+Chr(69) )  // Bold ON 

   @ 0,PCol() + 1 SAY "Bold printed text" 

   PrintEscSequence( Chr(27)+Chr(70) ) // Bold OFF 
   PrintEscSequence( Chr(27)+Chr(52) ) // Italic ON 

   @ 0,PCol() + 1 SAY "Italic printed text" 

   PrintEscSequence( Chr(27)+Chr(53) ) // Italic OFF 

   EJECT 
   SET DEVICE TO SCREEN 

RETURN 

FUNCTION PrintEscSequence( cEscSeq ) 
   LOCAL nRow := PRow(), nCol := PCol() 

   ?? cEscSeq 

RETURN SetPrc( nRow, nCol ) 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.