Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Grumpfish Library 3.2 - <b>colorset()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
COLORSET()

    COLORSET() is used throughout Grumpfish Library wherever SETCOLOR()
    would ordinarily be called.  This permits all Grumpfish Library
    color settings to be maintained in one place, thereby making color
    management totally painless.

    Syntax

    ColorSet(<attribute> [, <newcolor>])

    Required Parameter

    <attribute> is an integer representing which color to use.  At
    press time, there are 34 items in the colors array, so this parameter
    could be of the range 1 to 34.  See below for the contents of the
    colors array.

    Optional Parameter / Return Value

    <newcolor> is rather flexible:

    - If you do not pass this parameter, ColorSet() will change the
      current color to the setting in the specified array element and
      return the previous color setting.

    - If you pass a character string, ColorSet() will change the
      specified array element to that particular color, change the color
      setting, and return the previous setting.

    - If you pass something else (for example, a logical value),
      ColorSet() will simply return the value stored in the specified
      array element without changing the color setting.

    Notes

    The COLORSET() / COLORINIT() / COLORMOD() trio of functions makes
    Grumpfish Library color management a breeze.  The color settings for
    all Grumpfish Library items are stored in a STATIC array in the
    file COLORSET.PRG:

    Item                          Color     Mono    Manifest Constant

    Current Entry Fields          +W/N        I     C_GETS
    Message Boxes                 +W/BR     +W/N    C_MESSAGE
    Blinking Messages             +W*/BR     *I     C_MESSAGEBLINK
    Wait Messages                 +GR/N     +W/N    C_WAITMESSAGE
    Blinking Wait Messages        +GR*/N    +W*/N   C_WAITMESSAGEBLINK
    Yes/No Messages               +W/RB     +W/N    C_YESNO
    Error Box Outline             W/R         I     C_ERRORBOX
    Error Messages                +W/R        I     C_ERRORMESSAGE
    Memoedit Window Outline       +W/R       W/N    C_MEMEDIT_BOX
    Memoedit Window Interior      +W/N       +W/N   C_MEMEDIT_WINDOW
    Stopwatch Box                 W/B        W/N    C_STOPWATCH_BOX
    Stopwatch Window              +W/N        I     C_STOPWATCH_WINDOW
    Calculator Box                W/RB       W/N    C_CALCULATOR_BOX
    Calculator Window             +W/N        I     C_CALCULATOR_WINDOW
    Notepad Box                   +W/B       W/N    C_NOTEPAD_BOX
    Notepad Window                +W/N       W/N    C_NOTEPAD_WINDOW
    Phonebook Main Window         +W/R       W/N    C_PHONEBOOK_WINDOW1
    Phonebook Edit Window         +W/B       W/N    C_PHONEBOOK_WINDOW2
    Calendar Window               W/B        W/N    C_CALENDAR
    Appointment Window            +W/BG      +W/N   C_APPOINTMENT
    Picklist Box Outline          +W/B       +W/N   C_APICK_BOXOUTLINE
    Picklist Status Bar           W/N        W/N    C_APICK_STATUSBAR
    Picklist Indicator            +GR/N       I     C_APICK_INDICATOR
    Picklist Unselected Items     W/B        W/N    C_APICK_UNSELECTED
    Picklist Highlighted Item     I           I     C_APICK_CURRENT
    Picklist Tagged Items         +GR/B      +W/N   C_APICK_TAGGED
    Picklist Tagged/Current       +W/R        I     C_APICK_TAGGEDCURRENT
    Picklist Unavailable Items    R/B        +W/N   C_APICK_UNAVAILABLE
    Picklist Unavailable/Current  N/B         I     C_APICK_UNAVAILABLECURRENT
    Unselected Menu Options       W/B        W/N    C_MENU_UNSELECTED
    Selected Menu Options         +GR/R       I     C_MENU_SELECTED
    DataBrowse Box                W/B        W/N    C_GRUMPBROW_BOX
    DataBrowse Text               +W/B       +W/N   C_GRUMPBROW_SAY
    DataBrowse Highlight          +W/N        I     C_GRUMPBROW_GET

    (Note that the monochrome setting for Message Boxes has been changed
    from what is shown in the printed documentation.)

    To refer to a particular setting, you would pass the appropriate
    manifest constant.

    Adding Your Own Colors

    It is possible (as well as desirable) to add your own colors to the
    Grumpfish Library 5.01 color management system.  To do so, you would
    add colors to the file-wide static array at the top of COLORSET.PRG.
    You must add a nested array of three elements for each new color.
    The structure of each nested array would be:

    a[1] == Setting for color monitors
    a[2] == Setting for monochrome monitors
    a[3] == Character string containing description of color

    You should also change the manifest constant COLOR_CNT to reflect
    the new length of the colors array.  For example, if you add four
    colors, COLOR_CNT would be 38 rather than 34.

    Sample Usage

    ** change to Yes/No Message color, return previous setting              
    oldcolor := ColorSet(C_YESNO)                                         
    ** change Stopwatch box color to red on blue and return previous setting
    oldcolor := ColorSet(C_STOPWATCH_BOX, 'r/b')                            
    ** return Error Message color, do not change color setting              
    oldcolor := ColorSet(C_ERRORMESSAGE, .T.)                               

See Also: COLORINIT() COLORMOD()

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