Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>set color</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
SET COLOR


Syntax:     SET COLOR/COLOUR TO [<standard> [,<enhanced>]
            [,<border>] [,<background>] [,<unselected>]]/(<expC>)

Purpose:    To define colors for the next screen painting activity.

Options:    Standard/Enhanced: The "standard" and "enhanced" options
            are color pairs with a foreground and an optional background
            color.  "Standard" is used by all output, such as @...SAY
            and ?.  "Enhanced" setting affects only the display of GETs
            and PROMPTs.

            Border: Sets border color.

            Background: The "background" is not currently supported
            by any machines for which Nantucket provides drivers.

            Unselected: The "unselected" option is a color pair
            which allows the current GET to be displayed in the
            "enhanced" setting while other GETs are the "unselected"
            color.

            Attributes: High intensity and blinking are the
            attributes of colors.  High intensity is denoted by "+" and
            blinking with "*".  Each attribute specified is applied to
            the foreground color no matter where it occurs in the
            setting definition.  This means that attributes applied to
            the background color have no affect on the background color,
            but are applied to the foreground color instead.

            SET COLOR TO with no argument restores the default values
            which are:  W/N,N/W,,,N/W.

Usage:      There are a number of colors supported for enhancing screen
            display.  Each color is denoted by a letter or number.  When
            you specify a color setting, numbers and letters should not
            be mixed.  When numbers are used, the number to the left of
            the slash is written to the high order 4 bits of the color
            attribute byte, and the number to the right is written to
            the low order 4 bits.

            Monochrome monitors: On monochrome monitors, color is
            not supported.  Clipper, however, supports the monochrome
            attributes reverse video (I) and underlining (U).

            Screen drivers:  SET COLOR TO using numbers is not
            supported if ANSI.OBJ is linked with the current program.

            Color variables: To make managing color easier, assign
            color definitions to memory variables.  This will allow you
            to centralize the assignment of colors and implementation of
            runtime color configuration for users.

            To set each color configuration, assign the complete SET
            COLOR argument as a character string to a single memory
            variable.  Then use macro substitution or bound the color
            variable when you SET COLOR.  For example:

            c_says = "W/N,BG+/B,,,W/N"
            SET COLOR TO &c_says.
            *
            SET COLOR TO (c_says)

            Note that in this specific case a list containing commas is
            allowed within a macro variable.

            Since you may have a great number of color variables in a
            large system, you may also want to name color variables as a
            class by specifying each one with a leading identifier such
            as "c_."  When you run your cross-reference utility, you
            will appreciate the grouping.

Library:    CLIPPER.LIB


----------------------------------- Examples -------------------------------

   The following demonstrates using a color setting to suppress the
   screen in order to enter a protected password:

   SET COLOR TO W+/N, X
   password = SPACE(6)

   @ 13, 12 SAY  "Password: ";
      GET   password;
      VALID Password(password, "secret")
   READ

   SET COLOR TO

   RETURN


   FUNCTION Password
   PARAMETERS getvar, word

   IF getvar <> word
      @ 22, 00
      WAIT "Bad password, press any key..."
      @ 23, 00
      RETURN .F.
   ENDIF
   RETURN .T.


   The following example makes the current GET red on white while the
   rest are black on white.

   color = "W/N,R/W,,,N/W"
   SET COLOR TO &color.
   STORE SPACE(10) TO one, two, three

   @ 1, 1 SAY "Enter One: " GET one
   @ 2, 1 SAY "Enter Two: " GET two
   @ 3, 1 SAY "Enter Three: " GET three

   READ


See Also: @...SAY...GET ISCOLOR() SETCOLOR() Color table

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson