Functions and Directives

Function PRow() Foundation

Determines the row position of the print head.

Syntax
PRow() --> nRow
Return

The return value of PRow() is a positive integer which corresponds to the current print row. The first row position has the value zero.

Description

The row position of the print head is determined using the environment function PRow(). The function manages an internal counter which is only updated when output to a printer occurs due to SET DEVICE TO PRINTER or SET PRINTER ON. The internal counter has the value zero at the start of the program. Following the command EJECT the counter is set back to zero. Otherwise PRow() works like the function Row(), except that it tracks the printer and not the screen.

The internal counter is updated to correspond with the print row when characters are output with ?, QOut() or @..SAY. When control characters like Line-Feed (Chr(10)) or Form-Feed (Chr(12)) are sent to the printer and directly change the row position of the print head, the internal counter of PRow() differs from the current position of the print head. PRow() does not recognize these control characters. In this case the value of PRow() must be set to the correct value using the function SetPrc().

The function PRow() is used along with the function PCol() for formatting the output of forms or tables where the print position occurs relative to the last position of the print head.

Examples
PRow()
// The example shows a print program for address labels 
// which are printed using SetPrc(), PRow() and PCol(). 

PROCEDURE Main 

   USE Customer NEW EXCLUSIVE 
   INDEX ON Upper(Lastname+Firstname) TO CustA 

   SET DEVICE TO PRINTER 
   SetPrc( 2, 0 ) 

   DO WHILE .NOT. Eof() 


      @ PRow()   , 0        SAY Trim( Firstname ) 


      @ PRow()   , PCol()+1 SAY Trim( Lastname ) 


      @ PRow()+1 , 0        SAY Address 


      @ PRow()+1 , 0        SAY Trim( City ) + "," 


      @ PRow()   , PCol()+1 SAY Trim( State ) 


      @ PRow()   , PCol()+1 SAY Zip 


      SKIP 
      SetPrc( 2, 0 ) 
   ENDDO 

   SET DEVICE TO SCREEN 

   CLOSE Customer 
RETURN 

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.