[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PCOL()
 Return the current column position of the printhead
------------------------------------------------------------------------------
 Syntax

     PCOL() --> nColumn

 Returns

     PCOL() returns an integer numeric value representing the last printed
     column position, plus one.  The beginning column position is zero.

 Description

     PCOL() is a printer function that reports the column position of the
     printhead after the last print operation.  PCOL() is updated only if
     either SET DEVICE TO PRINTER or SET PRINTER ON is in effect.  PCOL() is
     the same as COL() except that it relates to the printer rather than the
     screen.  PCOL() is updated in the following ways:

     .  Application startup sets PCOL() to zero

     .  EJECT resets PCOL() to zero

     .  A print operation sets PCOL() to the last column print
        position plus one

     .  SETPRC() sets PCOL() to the specified column position

     PCOL(), used with PROW(), prints a value relative to the last value
     printed on the same line.  This makes it easier to align columns when
     printing a columnar report.  A value is printed in the next column by
     specifying its position as PCOL() + <column offset>.  Note that PCOL()
     is effective for alignment only if the column values are fixed-width.
     To guarantee fixed-width column values, format the output using
     TRANSFORM(), the PICTURE clause of @...SAY, or any of the PAD()
     functions.

 Notes

     .  Printer control codes:  Sending control codes to the printer
        causes PCOL() to become out of sync with the printhead position.
        Although control codes do not print, this discrepancy happens because
        CA-Clipper counts all characters sent to the printer regardless of
        how the printer treats them.  To make the necessary adjustment, save
        the current PROW() and PCOL() values, send the control codes, and
        then use SETPRC() to restore the original PROW() and PCOL() values.

     .  SET MARGIN:  PCOL() cannot reliably be used with SET MARGIN to
        print with @...SAY.  When printing with @...SAY, the current MARGIN
        value is always added to the specified column position before output
        is sent to the printer.  This effectively adds the MARGIN value to
        PCOL() for each invocation of @...SAY to the same print line.

 Examples

     .  In this example, PCOL() creates a simple report that prints a
        listing of Customer names, addresses, and phone numbers:

        LOCAL nLine := 99, nPage := 1
        USE Customer INDEX CustName NEW
        SET DEVICE TO PRINTER
        DO WHILE !EOF()
           IF nLine > 55
              PageTop(nPage)
              nLine := 1
              nPage++
           ENDIF
           @ nLine, 10 SAY CustName
           @ nLine, PCOL() + 2;
              SAY RTRIM(City) + ", " + RTRIM(State) + ZipCode;
                    PICTURE REPLICATE("X", 35)
           @ nLine, PCOL() + 2;
              SAY Phone;
                    PICTURE "@R (999) 999-9999"
           nLine++
           SKIP
        ENDDO
        SET DEVICE TO SCREEN
        CLOSE

 Files   Library is CLIPPER.LIB.


See Also: ?|?? @...SAY EJECT PAD() PROW() QOUT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson