Grigory Filatov

Contributed works of Grigory Filatov

Adaptation FiveWin TsBrowse class
Color Table
Center Window’s Title
Closes application when no activity
Copy Protection (Get BIOS Name)

GetFonts
Get list of all controls

GIF animation demo

WAIT

WAIT*

Suspend program processing until a key is pressed

Syntax

      WAIT [<expPrompt>] [TO <idVar>]

Arguments

<expPrompt> is an expression of any data type displayed as a prompt. If no <expPrompt> is specified, the default prompt displayed is: “Press any key to continue…”

TO <idVar> is the variable, of any storage class, that holds the value of the key pressed as a character value. If <idVar> does not exist or is not visible, it is created as a private variable and then assigned the character value.

Description

WAIT is a console command and wait state that displays a prompt after sending a carriage return/line feed to the screen. It then waits for the user to press a key. If the TO clause is specified, <idVar> is assigned the keystroke as a character value. If an Alt or Ctrl key is pressed, WAIT assigns CHR(0) to <idVar>. Non-alphanumeric values entered by pressing an Alt-keypad combination assign the specified character. If the character can be displayed, it is echoed to the screen. Function keys are ignored unless assigned with SET FUNCTION or SET KEY.

WAIT is a compatibility command and, therefore, is not recommended for general usage. It is superseded by both @…GET/READ and INKEY() for getting single character input.

Notes

. WAITing without a prompt: To pause execution without displaying a prompt, specify WAIT, null string (“”), or INKEY(0). The latter is recommended since it does not disturb the current screen cursor position.

Examples

      .  This example illustrates how to store the WAIT keystroke as an
         array element:

      aVar := ARRAY(6)

      WAIT "Press a key..." TO aVar[1]
      ? aVar[1]                  // Result: key pressed in
                                 // response to WAIT
      ? aVar[2]                  // Result: NIL
      ? VALTYPE(aVar)            // Result: A
      ? VALTYPE(aVar[1])         // Result: C

Seealso

@…GET, ACCEPT*, INKEY(), INPUT*, MENU TO

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 SCOREBOARD

SET SCOREBOARD

Toggle the message display from READ or MEMOEDIT()

Syntax

      SET SCOREBOARD ON | off | <xlToggle>

Arguments

ON allows the display of messages from READ and MEMOEDIT() on line zero of the screen.

OFF suppresses these messages.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Description

SET SCOREBOARD controls whether or not messages from READ and MEMOEDIT() display on line zero. When SCOREBOARD is ON, READ displays messages for RANGE errors, invalid dates, and insert status. MEMOEDIT() displays an abort query message and the insert status.

To suppress the automatic display of these messages, SET SCOREBOARD OFF.

Seealso

@…GET, MEMOEDIT(), READ

SET DELIMITERS

SET DELIMITERS

Toggle or define GET delimiters

Syntax

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

Arguments

ON displays delimiters for GET variables.

OFF suppresses the delimiter display.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

TO <cDelimiters> defines a one or two character delimiter. Specifying a single character uses the same character as both the beginning and ending delimiter. Specifying two characters uses the first as the beginning delimiter and the second as the ending delimiter.

TO DEFAULT or no delimiters SETs the delimiters to colons which are the default delimiters.

Description

SET DELIMITERS is a dual purpose command that both defines characters used to delimit GETs and toggles the automatic display of delimiters ON or OFF. The @…GET command can display delimiters that surround a Get object’s display. If DELIMITERS is ON, the delimiters add two characters to the length of the Get object display.

You can configure the delimiter characters using the TO <cDelimiters> clause. The DEFAULT delimiter character is the colon (:). When specifying delimiters, the beginning and ending delimiter characters can be different. If you wish to suppress either the right, left, or both delimiters, use a space instead of the delimiter character.

Typically, delimiters are unnecessary since GETs display in reverse video or enhanced color if INTENSITY is ON.

Examples

      .  This example SETs DELIMITERS TO a colon and a space for the
         first GET and the square bracket characters for the second:

      LOCAL cVar := SPACE(5), cVar2 := SPACE(5)
      SET DELIMITERS ON

      SET DELIMITERS TO ": "
      @ 1, 0 SAY "Enter" GET cVar
      SET DELIMITERS TO "[]"
      @ 2, 0 SAY "Enter" GET cVar2
      READ

Seealso

@…GET, SET INTENSITY

SET CONFIRM

SET CONFIRM

Toggle required exit key to terminate GETs

Syntax

      SET CONFIRM on | OFF | <xlToggle>

Arguments

ON requires the user to press an exit key to leave a GET.

OFF allows the user to leave a GET by typing past the end without pressing an exit key.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Description

SET CONFIRM determines whether an exit key is required to leave a GET. If CONFIRM is OFF, the user can type past the end of a GET and the cursor will move to the next GET, if there is one. If there is not another GET, the READ terminates. If, however, CONFIRM is ON, an exit key must be pressed to leave the current GET.

In all cases, attempting to leave the current GET executes the RANGE or VALID clauses, unless the user presses the Esc key. See @…GET for more information on the behavior of GETs.

Seealso

@…GET, READ, SET BELL

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