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

DevOutPict

DevOutPict

Writes a PICTURE formatted value to the current device.

Syntax

      DevOutPict( <expression>, <cPicture> [,<cColor>] ) --> NIL

Arguments

<expression> : Any valid expression to write to the device assigned by SET DEVICE command

<cPicture> : A valid PICTURE format string.

<cColor> : A valid color codes string for value to write. Default is current color setting

Returns

DevOutPict() always returns NIL

Description

DevOutPict() is a console function that outputs the value of an expression to the screen or the printer with defined PICTURE and color. Output device depens on current device.

Example

      DevOutPict( CUST->DEBIT, "99,999.99" )

Seealso

@…SAY, Col(), DevOut(), DevPos(), QOut() | QQOut(), Row(), SET DEVICE, SetPos(), Transform()

DevOut

DevOut

Writes a value to the current device

Syntax

      DevOut( <expression>, [<cColor>], [<nRow>, <nCol>] ) --> NIL

Arguments

<expression> : Any valid expression to write to the device assigned by SET DEVICE command

<cColor> : A valid color codes string for value to write. Default is current color setting <nRow> and

<nCol> : Row and column value for device to write <expression>. Defaults is ROW() and COL() if current device is screen and PRow() and PCol() for the printer.

Return

DevOut() returns always NIL

Description

DevOut() is a console function that outputs the value of an expression to the screen or the printer depending on current device.

Example

      // Write a string at upper left corner of screen :

      DevOut( "Here is upper left corner", "W+/R", 0, 0  )

        Equivalent usage :

      @ 0, 0 SAY "Here is upper left corner" COLOR "W+/R"

Seealso

@…SAY, Col(), DevOutPict(), DevPos(), QOut() | QQOut(), Row(), SET DEVICE, SetPos()

ISPRINTER

ISPRINTER()

Determine whether LPT1 is ready

Syntax

      ISPRINTER() --> lReady

Returns

ISPRINTER() returns true (.T.) if LPT1 is ready; otherwise, it returns false (.F.).

Description

ISPRINTER() is a printer function that determines whether the parallel port (LPT1) is online and ready to print. ISPRINTER() is hardware-dependent and, therefore, only works on IBM BIOS compatible systems.

You can check ISPRINTER() to make sure the printer is ready before you begin a print operation; however, if an error occurs during the print operation, a runtime error is generated.

Examples

      .  This example tests the parallel port for readiness with up to
      25 retries.  If the parallel port is ready, the printer operation
      begins:

      LOCAL nCount := 0, nTimes := 25, lReady
      //
      DO WHILE nCount++ <= nTimes .AND. !(lReady := ;
            ISPRINTER())
      ENDDO
      //
      IF lReady
         REPORT FORM Sales TO PRINTER
      ELSE
         ? "Printer not ready..."
         BREAK
      ENDIF

Seealso

SET DEVICE, SET PRINTER

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

SET PRINTER

SET PRINTER

Toggles the printer and controls the printer device

Syntax

      SET PRINTER on | OFF
      SET PRINTER (<lPrinter>)
      SET PRINTER TO [<cPrinter>] [ADDITIVE]

Arguments

<lPrinter> Logical condition by which to toggle the printer

<cPrinter> A device name or an alternate name

Description

This command can direct all output that is not controlled by the @…SAY command and the DevPos() and DevOut() functions to the printer. If specified, the condition <lPrinter> toggles the printer ON if a logical true (.T.) and OFF if a logical false (.F.). If no argument is specified in the command, the alternate file (if one is open) is closed, or the device is reselected and the PRINTER option is turned OFF.

If a device is specified in <cPrinter>, the output will be directed to that device instead of to the PRINTER. A specified device may be a literal string or a variable, as long as the variable is enclosed in parentheses. For a network, do not use a trailing colon when redirecting to a device.

If an alternate file is specified, <cPrinter> becomes the name of a file that will contain the output. If no file extension is specified an extension of .prn will be defaulted to.

If the ADDITIVE clause is specified, the information will be appended to the end of the specified output file. Otherwise, a new file will be created with the specified name (or an existing file will first be cleared) and the information will then be appended to the file. The default is to create a new file.

Examples

      SET PRINTER ON
      SET PRINTER TO LPT1
      ? 25141251 / 362
      SET PRINTER .F.

Compliance

Clipper

Seealso

SET DEVICE, SET CONSOLE, DevOut(), Set()

SET CONSOLE

SET CONSOLE

Toggle the console display

Syntax

      SET CONSOLE ON | off | (<lConsole>)

Arguments

<lConsole> Logical expression for toggle command

Description

This command turns the screen display either off or on for all screens display other then direct output via the @…SAY commands or the <-> DevOut() function.

If <lConsole> is a logical true (.T.), the console will be turned ON; otherwise, the console will be turned off.

Examples

      SET CONSOLE ON
      ? Date()
      SET CONSOLE OFF
      ? Date()

Compliance

Clipper

Seealso

SET DEVICE, Set()

@…SAY

@…SAY

Displays data at specified coordinates of the current device.

Syntax

      @ <nRow>,<nCol> SAY <xValue> [ PICTURE <cPict> ] [COLOR <cColor>]

Arguments

<nRow> Row coordinate

<nCol> Column coordinate

<xValue> Value to display

<cPict> PICTURE format

<cColor> Color string

Description

This command displays the contents of <xValue> at row column coordinates <nRow>, <nCol>. A PICTURE clause may be specified in <cPict>. If the current device is set to the printer, the output will go to the printer; the default is for all output to go to the screen.

For a complete list of PICTURES templates and functions, see the @…GET command.

Examples

      PROCEDURE Main()
         CLS
         @ 2, 1 SAY "Harbour"
         @ 3, 1 SAY "is" COLOR "b/r+"
         @ 4, 1 SAY "Power" PICTURE "@!"
         RETURN

Tests

      See Examples

Compliance

Clipper

Platforms

All

Seealso

@…GET, SET DEVICE, TRANSFORM()

Send to file

Write data to a file

Sending lines to a file is quite easy :

In addition of SET PRINTER on | OFF | <xlToggle> command, SET PRINTER, (like many other SET commands,) has a second form distinguished by TO keyword:

SET PRINTER TO [<xcDevice> | <xcFile> [ADDITIVE]]

The on|OFF form of SET PRINTER controls whether the output of console commands is echoed to the printer.

TO <xcDevice> identifies the name of the device where all subsequent printed output will be sent.

TO <xcFile> identifies the name of the output file. ( If a file extension is not specified, (.prn) is assumed.)

By using that last method we can send our lines to a file, instead of sending directly to printer:

 SET PRINTER TO Prnfile.txt
 SET DEVICE TO PRINTER
 SET PRINTER ON
 //
 @ 0, 0 SAY "This goes to Prnfile.txt"
 ? "So will this!"
 //
 SET DEVICE TO SCREEN
 SET PRINTER OFF
 SET PRINTER TO // Close the print file

Note that, though our target is not printer, we have use a SETting printer ON.

We have another method for sending someting to a file may be SET ALTERNATE command:

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

SET ALTERNATE is a console command that lets you write the output of console commands to a text file. Commands such as LIST, REPORT FORM, LABEL FORM, and ? that display to the screen without reference to row and column position are console commands. Most of these commands have a TO FILE clause that performs the same function as SET ALTERNATE. Full-screen commands such as @…SAY cannot be echoed to a disk file using SET ALTERNATE. Instead you can use SET PRINTER TO <xcFile> with SET DEVICE TO PRINTER to accomplish this.

SET ALTERNATE has two basic forms. The TO <xcFile> form creates a DOS text file with a default extension of (.txt) and overwrites any other file with the same name. Alternate files are not related to work areas with only one file open at a time. To close an alternate file, use CLOSE ALTERNATE, CLOSE ALL, or SET ALTERNATE TO with no argument.

The on|OFF form controls the writing of console output to the current alternate file. SET ALTERNATE ON begins the echoing of output to the alternate file. SET ALTERNATE OFF suppresses output to the alternate file but does not close it.

Examples :

This example creates an alternate file and writes the results of the ? command to the file for each record in the Customer database file:

 SET ALTERNATE TO Listfile
 SET ALTERNATE ON
 USE Customer NEW
 DO WHILE !EOF()
 ? Customer->Lastname, Customer->City
 SKIP
 ENDDO
 SET ALTERNATE OFF
 CLOSE ALTERNATE
 CLOSE Customer

A single difficulty may be making choose the best between possible methods

You can download a working example prg with a sample .dbf from here :

C5 UI Global Settings

C5 User Interface Global Settings :

SET CENTURY :

Modify the date format to include or omit century digits

SET CENTURY on | OFF | <xlToggle>

SET COLOR* :

Define screen colors

SET COLOR | COLOUR TO [[<standard>]
    [,<enhanced>] [,<border>] [,<background>]
    [,<unselected>]] | (<cColorString>)

SET CONFIRM :

Toggle required exit key to terminate GETs

SET CONFIRM on | OFF | <xlToggle>

SET CONSOLE :

Toggle console display to the screen

SET CONSOLE ON | off | <xlToggle>

SET CURSOR :

Toggle the screen cursor on or off

SET CURSOR ON | off | <xlToggle>

SET DATE :

Set the date format for input and display

SET DATE FORMAT [TO] <cDateFormat>
SET DATE [TO] AMERICAN | ansi | british | french
    | german | italian | japan | usa

SET DECIMALS :

Set the number of decimal places displayed

SET DECIMALS TO [<nDecimals>]

SET DELIMITERS :

Toggle or define GET delimiters

SET DELIMITERS on | OFF | <xlToggle>
SET DELIMITERS TO [<cDelimiters> | DEFAULT]

SET DEVICE :

Direct @…SAYs to the screen or printer

SET DEVICE TO SCREEN | printer

SET EPOCH :

Control the interpretation of dates with no century digits

SET EPOCH TO <nYear>

SET FIXED :

Toggle fixing of the number of decimal digits displayed

SET FIXED on | OFF | <xlToggle>

SETBLINK() :

Toggle asterisk (*) interpretation in SET COLOR

SETBLINK([<lToggle>]) --> lCurrentSetting

SETCOLOR() :

Return the current colors and optionally set new colors

SETCOLOR([<cColorString>]) --> cColorString

SETCURSOR() :

Set the cursor shape

SETCURSOR([<nCursorShape>]) --> nCurrentSetting

SETMODE() :

Change display mode to specified number of rows and columns

SETMODE(<nRows>, <nCols>) --> lSuccess

SETPOS() :

Move the cursor to a new position

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