DevPos

DevPos

Moves the cursor or printhead to a row and column coordinate

Syntax

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

Arguments

@ <nRow>, <nCol> : Coordinates for write; screen of printer depending to SET DEVICE setting.

Return

DevPos() returns always NIL.

Description

<nRow>, <nCol> are row and column coordinates and positions the screen cursor or printhead accordingly. Coordinates begin at point 0, 0 which is the upper left corner of the screen, or paper.

IF DEVICE SETted to SCREEN, DevPos() moves the screen cursor to the specified coordinates and updates Row() and Col().

IF DEVICE SETted to PRINTER, DevPos() moves the printhead to the new row and column coordinate and updates PRow() and PCol().

Notes

SetPrc() adjust the internal counters of PRow() and PCol().

When printer output is redirected to a file by SET PRINTER TO command, DevPos() output is recorded in that file.

Seealso

@…SAY, Col(), DevOut(), PCol(), PRow(), QOut() | QQOut(), ROW(), SET DEVICE, SetPos(), SetPrc()

SET MARGIN

SET MARGIN

Set the page offset for all printed output

Syntax

      SET MARGIN TO [<nPageOffset>]

Arguments

TO <nPageOffset> is a positive number that defines the number of column positions to indent from the left side of the page for subsequent printed output. A negative value resets the MARGIN to zero.

SET MARGIN TO with no argument resets the page offset to zero, the default value.

Description

SET MARGIN is valid for all output directed to the printer from console commands and @…SAY. With console output, the <nPageOffset> indent is output whenever there is a new line. With @…SAY, <nPageOffset> is added to each column value. SET MARGIN has no effect on screen output.

Note

Printing with @…SAY and PCOL() with a MARGIN SET in most cases adds the MARGIN to each column position. This happens because PCOL() accurately reflects the print column position including the last <nPageOffset> output. The best approach is to avoid the use of SET MARGIN with PCOL() for relative column addressing.

Examples

      .  This example sets a page offset of 5, and then prints a list
         from Sales.dbf:

      USE Sales NEW
      SET MARGIN TO 5
      LIST Branch, Salesman TO PRINTER
      SET MARGIN TO

Seealso

@…SAY, PCOL(), SET DEVICE, SET PRINTER

EJECT

EJECT

Issue an command to advance the printer to the top of the form

Syntax

      EJECT

Arguments

None

Description

This command issue an form-feed command to the printer. If the printer is not properly hooked up to the computer, an error will not be generated and the command will be ignored.

Once completed, the values of PROW() and PCOL(), the row and column indicators to the printer, will be set to 0. Their values, however, may be manipulated before or after ussuing an EJECT by using the DEVPOS() function.

On compile time this command is translated into __EJECT() function.

Examples

      Use Clientes New
      Set Device to Printer
      CurPos:=0
      While !Eof()
      ? Clientes->nome,Clientes->endereco
      Curpos++
      if Curpos >59
          Curpos:=0
          Eject
      Endif
      Enddo
      Set Device to Screen
      Use

Tests

      See examples

Compliance

Clipper

Platforms

All

Seealso

DEVPOS(), SET PRINTER, PROW(), PCOL()

C5_PCOL

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



CL5 Printing Commands, Statements and Funtions

?/?? :

Display or print one or more values to the console or printer

? | ?? [<exp list>]

@…SAY :

Display or print data at a specified screen or printer row and column

@ <nRow>, <nCol>
   [SAY <exp>
   [PICTURE <cSayPicture>]
   [COLOR <cColorString>]]
   [GET <idVar>
   [PICTURE <cGetPicture>]
   [COLOR <cColorString>]]
   [WHEN <lPreExpression>]
   [RANGE* <dnLower>, <dnUpper>] |
   [VALID <lPostExpression>]

DEVPOS() :

Move the cursor or printhead to a new position depending on the current device

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

DISPLAY :

Display or print records to the console or printer

DISPLAY <exp list>
   [TO PRINTER] [TO FILE <xcFile>]
   [<scope>] [WHILE <lCondition>]
   [FOR <lCondition>] [OFF]

EJECT :

Advance the print head to top of form

EJECT

ISPRINTER() :

Determine whether the LPT1 is ready

ISPRINTER() --> lReady

LABEL FORM :

Display or print labels to the console or printer

LABEL FORM <xcLabel>
   [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
   [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
   [SAMPLE]

LIST :

List or print records to the console or printer

LIST <exp list>
   [TO PRINTER] [TO FILE <xcFile>]
   [<scope>] [WHILE <lCondition>]
   [FOR <lCondition>] [OFF]

OUTSTD() :

Write a list of values to the standard output device

OUTSTD(<exp list>) --> NIL

PCOL() :

Return the current column position of the printhead

PCOL() --> nColumn

PROW() :

Return the current row position of the printhead

PROW() --> nRow

QOUT() :

Display or print a list of expressions to the console or printer

QOUT( [ <exp list> ] ) --> NIL
QQOUT( [ <exp list> ] ) --> NIL

REPORT FORM :

Display or print a report to the console or printer

REPORT FORM <xcReport>
   [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
   [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
   [PLAIN | HEADING <cHeading>] [NOEJECT] [SUMMARY]

SET MARGIN :

Set the page offset for all printed pages

SET MARGIN TO [<nPageOffset>]

SET PRINTER :

Toggle echo of console output to the printer or set the destination of printed output

SET PRINTER on | OFF | <xlToggle>
SET PRINTER TO [<xcDevice> | <xcFile> [ADDITIVE]]

SETPRC() :

Set PROW() and PCOL() values

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

TYPE :

Display or print the contents of a text file

TYPE <xcFile> [TO PRINTER] [TO FILE <xcOutFile>]