xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SetPrc()

Changes the PRow() and PCol() values.

Syntax

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

Arguments

<nRow>
This is a numeric value specifying the new return value of function PRow().
<nCol>
A numeric value specifying the new return value of function PCol().

Return

The return value is always NIL.

Description

SetPrc() is used to programmatically set the return values of functions PRow() and PCol(). Both functions maintain internal counters for monitoring the print head position in console applications when output is directed to the printer, either with SET PRINTER or SET DEVICE.

The PCol() value is incremented with every character sent to the printer. If a character string contains non printable characters or printer control codes, the physical print head does not change its position on paper while the internal counter is incremented. In this situation, the internal counter gets out of sync with the actual print head position. The internal counter must then be manually adjusted using SetPrc().

When print output is accomplished using @...SAY, SetPrc() is required to reset PRow() if the new row position is smaller than PRow(). Otherwise, an automatic page eject occurs.

Info

See also:PCol(), PRow(), SET DEVICE, Set()
Category: Environment functions
Source:rtl\console.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example implements a user-defined function that sends non-printable
// characters, or printer control characters, to the printer. The current
// PRow() and PCol() values are saved before characters are sent, and then
// restored using SetPrc().

   FUNCTION PrintCtrlCode( cCtrlCode )
      LOCAL lPrint := Set( _SET_PRINTER, .T. )
      LOCAL nRow   := PRow()
      LOCAL nCol   := PCol()

      ?? cCtrlCode

      Set( _SET_PRINTER, lPrint )
   RETURN SetPrc( nRow, nCol )

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe