DispOutAt

DispOutAt

Displays a value on the screen

Syntax

      DispOutAt( <nRow>      , ;
                    <nCol>      , ;
                    <expression>, ;
                    [<cColor>]  , ;
                    [<lSetPos>]   ) --> NIL

Arguments

<nRow> : Row number of screen to <expression> write

<nCol> : Column number of screen to <expression> write

<expression> : Any expression to write to the screen.

<cColor> : Color string for display

<lSetPos> : Specifies whether or not to update the screen cursor positions ( Row(), Col() after writing

Return

DispOutAt() returns always NIL.

Description

This function write the value of <expression> at the specified cursor position on the screen, using the color <cColor>, if specified.

Note

DispOutAt() don’t obey SET DEVICE setting and write always to the screen

Example

      DispOutAt( 0, 0, "Here upper left corner of screen", "W+/R" )

         is equvalent to :

         @ 0,0  SAY ""Here upper left corner of screen" COLOR  "W+/G"

Seealso

@ … SAY, Col(), DevOut(), DispBegin(), DispCount(), DispEnd(), DispOutAt(), OutStd(), QOut() | QQOut(), Row(), SetPos()

DispOut

DispOut

Displays a value on the screen

Syntax

      DispOut( <expression>, [<cColor>] ) --> NIL

Arguments

<expression> : Any expression to write to the screen.

<cColor> : Color string for display

Return

DispOut() returns always NIL.

Description

This function write the value of <expression> at the current cursor position on the screen, using the color <cColor>, if specified.

Note

DispOut() don’t obey SET DEVICE setting and write always to the screen

Example

      SetPos( 0, 0 )
         DispOut( "Here upper left corner of screen", "W+/R" )

         is equvalent to :

          @ 0,0  SAY ""Here upper left corner of screen" COLOR  "W+/G"

Seealso

@ … SAY, Col(), DevOut(), DispBegin(), DispCount(), DispEnd(), DispOutAt(), OutStd(), QOut() | QQOut(), Row(), SetPos()

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

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 FORMAT

SET FORMAT*

Activate a format when READ is executed

Syntax

      SET FORMAT TO [<idProcedure>[.<ext>]]

Arguments

TO <idProcedure> is a format (.fmt) file, a program (.prg) file, or a procedure.

<ext> is the extension of the format file. If not specified, the default extension is (.fmt).

SET FORMAT TO with no argument deactivates the current format.

Description

SET FORMAT defines a procedure to execute when a READ is invoked. Unlike the interpreted environment, formats are not opened and executed at runtime. Instead, the Harbour compiler treats SET FORMAT the same as a DO command. The compiler first looks to see whether it has already compiled a procedure with the same name as <idProcedure>. If it has, it uses that procedure for the reference. If <idProcedure> is not found, the compiler looks to disk for a file with the same name. If this file is not found, an external reference is generated that must be resolved at link time.

SET FORMAT is a compatibility command and not recommended.

Notes

. Active format procedures: Unlike other dialects where each work area can have an active format, Harbour supports only one active format procedure for all work areas.

. Screen CLEARing: Harbour does not clear the screen when a format procedure is executed.

. Legal statements: Format procedures allow statements and commands in addition to @…SAY and @…GET.

. Multiple pages: Harbour does not support multiple-page format procedures.

Examples

      .  This example uses a format procedure to add records to a
         database file until the user presses Esc:

      USE Sales NEW
      SET FORMAT TO SalesScr
      DO WHILE LASTKEY() != 27
         APPEND BLANK
         READ
      ENDDO
      RETURN

      PROCEDURE SalesScr
         @ 12, 12 SAY "Branch     : " GET  Branch
         @ 13, 12 SAY "Salesman   : " GET  Salesman
         RETURN

Seealso

@…GET, @…SAY, PROCEDURE, READ

SET COLOR

SET COLOR*

Define screen colors

Syntax

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

Arguments

<standard> is the color that paints all console, full-screen, and interface commands and functions when displaying to the screen. This includes commands such as @…PROMPT, @…SAY, and ?; as well as functions such as ACHOICE(), DBEDIT(), and MEMOEDIT().

<enhanced> is the color that paints highlighted displays. This includes GETs with INTENSITY ON, the MENU TO, DBEDIT(), and ACHOICE() selection highlight.

<border> is the color that paints the area around the screen that cannot be written to.

<background> is not currently supported by any machines for which Computer Associates provides drivers. This setting is supplied for compatibility purposes only.

<unselected> is a color pair that provides input focus by displaying the current GET in the enhanced color while other GETs are displayed in this color.

<cColorString> is a character string enclosed in parentheses containing the color settings. This facility lets you specify the color settings as an expression in place of a literal string or macro variable.

SET COLOR TO with no argument restores the default colors to W/N, N/W, N, N, N/W.

Description

SET COLOR, a command synonym for the SETCOLOR() function, defines colors for subsequent screen painting activity. Each SET COLOR command specifies a list of color settings for the five types of screen painting activity. Each setting is a foreground and background color pair separated by the slash (/) character. Foreground defines the color of characters displayed on the screen. Background defines the color displayed behind the character. Spaces and nondisplay characters display as background only.

In addition to color, a foreground setting can have an attribute, high intensity or blinking. With a monochrome display, high intensity enhances brightness of painted text. With a color display, high intensity changes the hue of the specified color making it a different color. For example, N displays foreground text as black where N+ displays the same text as gray. High intensity is denoted by +. The blinking attribute causes the foreground text to flash on and off at a rapid interval. Blinking is denoted with *. An attribute character can occur anywhere in a setting, but is always applied to the foreground color regardless where it occurs.

Each color can be specified using either a letter or a number, but numbers and letters cannot be mixed within a setting. Note that numbers are supplied for compatibility purposes and are not recommended.

All settings are optional. If a setting is skipped, its previous value is retained with only new values set. Skipping a foreground or background color within a setting sets the color to black.

The following colors are supported:

         Color Table
         -----------------------------------------------------------------------
         Color          Letter    Number  Monochrome
         -----------------------------------------------------------------------
         Black          N, Space  0       Black
         Blue           B         1       Underline
         Green          G         2       White
         Cyan           BG        3       White
         Red            R         4       White
         Magenta        RB        5       White
         Brown          GR        6       White
         White          W         7       White
         Gray           N+        8       Black
         Bright Blue    B+        9       Bright Underline
         Bright Green   G+        10      Bright White
         Bright Cyan    BG+       11      Bright White
         Bright Red     R+        12      Bright White
         Bright Magenta RB+       13      Bright White
         Yellow         GR+       14      Bright White
         Bright White   W+        15      Bright White
         Black          U                 Underline
         Inverse Video  I                 Inverse Video
         Blank          X                 Blank
         -----------------------------------------------------------------------

SET COLOR is a compatibility command and is not recommended. It is superseded by the SETCOLOR() function which can return the current color as well as set a new color.

Notes

. Monochrome monitors: Color is not supported on monochrome monitors. Clipper, however, supports the monochrome attributes inverse video (I) and underlining (U).

. Screen drivers: SET COLOR TO, using numbers, may not be supported by screen drivers other than the default screen driver.

Examples

      .  This example uses the unselected setting to make the current
         GET red on white while the rest are black on white:

          cColor:= "W/N,R/W,,,N/W"
          SET COLOR TO (cColor)
          cOne := cTwo := SPACE(10)
          @ 1, 1 SAY "Enter One: " GET cOne
          @ 2, 1 SAY "Enter Two: " GET cTwo
          READ

       .  In this example a user-defined function gets a password from
          the user using the blank (X) enhanced setting to hide the password as
          the user types:

          IF !DialogPassWord(12, 13, "W+/N", "FUNSUN", 3)
             ? "Sorry, your password failed"
             QUIT
          ENDIF

          FUNCTION DialogPassWord( nRow, nCol, ;
                 cStandard, cPassword, nTries )
             LOCAL nCount := 1, cColor := SETCOLOR()
             SET COLOR TO (cStandard + ", X")      // Blank input
             //
             DO WHILE nCount < nTries
                cUserEntry:= SPACE(6)
                @ nRow, nCol SAY  "Enter password: " GET ;
                         cUserEntry
                READ
                //
                IF LASTKEY() == 27
                   SET COLOR TO (cColor)
                   RETURN .F.

                ELSEIF cUserEntry == cPassword
                   SET COLOR TO (cColor)
                   RETURN .T.
                ELSE
                   nCount++
                ENDIF
             ENDDO
             //
             SET COLOR TO (cColor)
             RETURN .F.

Seealso

@…GET, @…SAY, ISCOLOR(), SETCOLOR(), SETBLINK()

READ

READ

Activate full-screen editing mode using Get objects

Syntax

      READ [SAVE] [MENU <oMenu>] [MSG AT <nRow>, <nLeft>,
             <nRight>] [MSG COLOR <cColorString>]

Arguments

SAVE retains the contents of the current GetList after the READ terminates. Later, you can edit the same Get objects by issuing another READ. If not specified, the current GetList is assigned an empty array deleting all of the previous Get objects when the READ terminates.

MENU <oMenu> specifies an optional Topbarmenu object that, when supplied, permits menu selection during data entry.

MSG AT <nMsgRow>, <nMsgLeft>, <nMsgRight> specify the row, left, and right margins where the Get object messages appear on the screen. If omitted, messages will not appear.

MSG COLOR <cMsgColor> defines the color setting of the message area. It consists of a single foreground/background color pair.

Description

READ executes a full-screen editing mode using all Get objects created and added to the current GetList since the most recent CLEAR, CLEAR GETS, CLEAR ALL or READ commands. If there is a format procedure active, READ executes that procedure before entering the full-screen editing mode.

Within a READ, the user can edit the buffer of each Get object as well as move from one Get object to another. Before the user can enter a Get object, control passes to the associated WHEN <lPreCondition> if one has been assigned to that Get object. If <lPreCondition> returns true (.T.), the user is allowed to edit the buffer of the Get object. Otherwise, control passes to the next Get object in the GetList. Within a GET buffer, the user can edit using the full complement of editing and navigation keys. See the tables below.

When the user presses a GET exit key, control passes to the associated RANGE or VALID postcondition if one has been specified. If either condition returns true (.T.), editing of the Get object is terminated and control passes to the next Get object. Otherwise, control remains within the current Get object until a valid value is entered or the user presses the Esc key.

When the user successfully enters a value into a Get object, the associated variable is assigned the value of the Get object’s buffer.

The following tables list active keys within a READ:

      READ Navigation Keys
      -----------------------------------------------------------------------
      Key                           Action
      -----------------------------------------------------------------------
      Left arrow, Ctrl+S            Character left. Does not move cursor to
                                    previous GET.
      Right arrow, Ctrl+D           Character right.  Does not move cursor to
                                    next GET.
      Ctrl+Left arrow, Ctrl+A       Word left.
      Ctrl+Right arrow, Ctrl+F      Word right.
      Up arrow, Shift+Tab, Ctrl+E   Previous GET.
      Down arrow, Tab, Ctrl+X,      Return, Ctrl+M Next GET.
      Home                          First character of GET.
      End                           Last character of GET.
      Ctrl+Home                     Beginning of first GET.
      -----------------------------------------------------------------------

      READ Editing Keys
      -----------------------------------------------------------------------
      Key                 Action
      -----------------------------------------------------------------------
      Del, Ctrl+G         Delete character at cursor position
      Backspace, Ctrl+H   Destructive backspace
      Ctrl+T              Delete word right
      Ctrl+Y              Delete from cursor position to end of GET
      Ctrl+U              Restore current GET to original value
      -----------------------------------------------------------------------

      READ Toggle Keys
      -----------------------------------------------------------------------
      Key            Action
      -----------------------------------------------------------------------
      Ins, Ctrl+V    Toggle insert mode
      -----------------------------------------------------------------------

      READ Exit Keys
      -----------------------------------------------------------------------
      Key                           Action
      -----------------------------------------------------------------------
      Ctrl+W, Ctrl+C, PgUp, PgDn    Terminate READ saving current GET
      Return, Ctrl+M                Terminate READ from last GET
      Esc                           Terminate READ without saving current GET
      Up arrow                      Terminate READ from first GET if
                                    READEXIT()=.T.
      Down arrow                    Terminate READ from last GET if
                                    READEXIT()=.T.
      -----------------------------------------------------------------------

Notes

. Nested READs: To perform a nested READ within a SET KEY, VALID, or WHEN procedure or user-defined function, declare or create a new GetList, perform a series of @…GET statements, and then READ. When the procedure terminates, the new GetList is released and the previous GetList becomes visible again. See the example below.

. Quick keys: Pressing Home or End in quick succession goes to the first or last nonblank character in a Get object’s buffer.

. Terminating a READ: A READ is terminated by executing a BREAK, CLEAR, CLEAR GETS, or CLEAR ALL from within a SET KEY procedure or a user-defined function initiated by VALID.

. UPDATED(): If any Get object buffer was changed during the current READ, UPDATED() is set to true (.T.).

Examples

      .  This example defines several GETs then READs them:

      CLEAR
      cVar1 := cVar2 := cVar3 := SPACE(10)
      @ 10, 10 SAY "Variable one:" GET cVar1 VALID ;
            !EMPTY(cVar1)
      @ 11, 10 SAY "Variable two:" GET cVar2 ;
               WHEN RTRIM(cVar1) !=  "One"
      @ 12, 10 SAY "Variable three:" GET cVar3 VALID ;
               !EMPTY(cVar3)
      READ

      .  This example performs a nested READ within a SET KEY, WHEN, or
         VALID procedure or user-defined function:

      LOCAL cName := SPACE(10)
      @ 10, 10 GET cName VALID SubForm( cName )
      READ
      RETURN

      FUNCTION SubForm( cLookup )
         LOCAL GetList := {}         // Create new GetList
         USE Sales INDEX Salesman NEW
         SEEK cLookup
         IF FOUND()
            @ 15, 10 GET Salesman    // Add Get objects to
            @ 16, 10 GET Amount      // new GetList
            READ                     // READ from new GetList
         ENDIF
         CLOSE Sales
         RETURN .T.                  // Release new GetList

Seealso

@…GET, @…SAY, CLEAR GETS, LASTKEY(), READEXIT()

? | ??

?|??

Display one or more values to the console

Syntax

       ? | ?? [<exp list>]

Arguments

<exp list> is a list of values to display and can be any combination of data types, including memo.

If you specify no argument and use the ? command, a carriage return/linefeed is sent to the console. If you use the ?? command without arguments, nothing happens.

Description

? and ?? are console commands that display the results of one or more expressions, separated by a space, to the console. These commands are also command synonyms for the QOUT() and QQOUT() functions, respectively.

Although functionally similar, ? and ?? differ slightly. ? sends a carriage return/linefeed to the console before displaying the results of the expression list. ?? displays output at the current screen cursor or printhead position. This lets you use successive ?? commands to display output to the same line.

A ? or ?? command locates the cursor or printhead one position to the right of the last character displayed. If SET PRINTER is OFF, ROW() and COL() are updated to reflect the new cursor position. If SET PRINTER is ON, PROW() and PCOL() are updated with the new printhead position.

If output from a ? or ?? command reaches the edge of the screen as reported by MAXCOL(), it wraps to the next line. If the output reaches the bottom of the screen as reported by MAXROW(), the screen scrolls up one line.

You can echo output from the ? or ?? commands to the printer by specifying a SET PRINTER ON command before beginning output. You can echo output from both of these commands to a text file using SET ALTERNATE TO <xcFile> to create the file, and SET ALTERNATE ON to begin echoing to the file. Like other console commands, SET CONSOLE OFF suppresses the display to the screen without affecting output to the printer or text file.

To format any expression specified, use TRANSFORM() or a user-defined function. If you need to pad a variable length value for column alignment, use any of the PAD() functions to left-justify, right- justify, or center the value. See the examples below.

Examples

       .  This example prints a record from a database file using ? and
          ?? commands with PADR() to ensure column alignment:
       LOCAL nPage := 0, nLine := 99
       USE Salesman INDEX Salesman NEW
       SET PRINTER ON
       SET CONSOLE OFF
       DO WHILE !EOF()
          IF nLine > 55
             IF nPage != 0
                EJECT
             ENDIF
             ? PADR("Page", LTRIM(STR(nPage++)), 72)
             ?? DTOC(DATE())
             ?
             ?
             ? PADC("Sales Listing", 79)
             ?
             nLine := 5
          ENDIF
          ? Name, Address, PADR(RTRIM(City) + "," ;
                + State, 20), ZipCode
          nLine++
          SKIP
       ENDDO
       SET CONSOLE ON
       SET PRINTER OFF
       CLOSE Salesman

Seealso

@…SAY, PAD(), QOUT(), SET ALTERNATE, SET CONSOLE, SET PRINTER