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

Advertisements

SET DEVICE

SET DEVICE

Directs all @…SAY output to a device.

Syntax

      SET DEVICE TO [printer | SCREEN ]

Arguments

None.

Description

This command determines whether the output from the @…SAY command and the DevPos() and DevOut() function will be displayed on the printer.

When the device is set to the PRINTER, the SET MARGIN value adjusts the position of the column values accordingly. Also, an automatic page eject will be issued when the current printhead position is less than the last printed row. Finally, if used in conjunction with the @…GET commands, the values for the GETs will all be ignored.

Examples

      SET DEVICE TO SCREEN
      ? 25141251 / 362
      SET DEVICE TO PRINTER
      SET PRINTER TO LPT1
      ? 214514.214 / 6325
      SET PRINTER OFF
      SET DEVICE TO SCREEN

Compliance

Clipper

Seealso

@…SAY, SET PRINTER, SetPRC(), Set()

C5_SETPRC

 SETPRC()
 Set PROW() and PCOL() values
------------------------------------------------------------------------------
 Syntax

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

 Arguments

     <nRow> is the new PROW() value.

     <nCol> is the new PCOL() value.

 Returns

     SETPRC() always returns NIL.

 Description

     SETPRC() is a printer function that sends control codes to the printer
     without changing the tracking of the printhead position.  When
     Clipper prints, it updates the PCOL() value with the number of
     characters sent to the printer.  There is no discrimination between
     printable or nonprintable characters.  If, for example, a string of ten
     characters sent to the printer contains two characters interpreted by
     the printer as a control code, the Clipper PCOL() value is
     incremented by ten, while the true printhead position is moved only by
     eight.  This can lead to alignment problems.  Using SETPRC(), you can
     compensate for control codes by resetting PCOL() as shown in the example
     below.

     SETPRC() also suppresses page ejects when printing with @...SAY.  This
     is important when the next row position is smaller than the current row
     and an EJECT has not been issued.  In this situation, CA-Clipper issues
     an automatic page eject if the next row print position is less than the
     current PROW() value.  Using SETPRC(), you can set PROW() to a number
     less than the current row, thus suppressing the automatic EJECT.

 Examples

     .  This user-defined function, PrintCodes(), uses SETPRC() to
        send control codes to the printer without affecting PROW() and PCOL()
        values:

        #include "Set.ch"
        #define ITALICS_ON   CHR(27) + "I"
        #define ITALICS_OFF   CHR(27) + "E"
        //
        SET DEVICE TO PRINTER
        @ 12, 10 SAY "This is an"
        @ PROW(), PCOL() + 2 SAY PrintCodes(ITALICS_ON) + ;
                 "important"
        @ PROW(), PCOL() + 2 SAY PrintCodes(ITALICS_OFF) + ;
                 "meeting"
        SET DEVICE TO SCREEN
        RETURN

        FUNCTION PrintCodes( cCtrlCode )
           LOCAL nRow, nCol, lPrinter
           lPrinter := SET(_SET_PRINTER, .T.)    // SET PRINTER ON
           nRow:= PROW()                         // Save printhead position
           nCol:= PCOL()
           //
           ?? cCtrlCode                          // Send control code
           //
           SETPRC(nRow, nCol)
           SET(_SET_PRINTER, lPrinter)           // Restore printer setting
           RETURN ""                             // Return a null string

 Files   Library is CLIPPER.LIB.

See Also: PCOL() PROW() SET DEVICE SET()



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