Return the current column position of the printhead

     PCOL() --> nColumn


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


     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()


     .  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
        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.


     .  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
        DO WHILE !EOF()
           IF nLine > 55
              nLine := 1
           @ 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"

 Files   Library is CLIPPER.LIB.

See Also: ?|?? @…SAY EJECT PAD() PROW() QOUT()


One response to “C5_PCOL

  1. Pingback: C5_SET MARGIN | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.