Exchanges particular characters in a screen area.


              <nRightcolumn>, [<cNewcharacter|nNewcharacter>],
              [<cOldcharacter|nOldcharacter>]]) --> cNull


<nTopline> Designates the line for the top-left corner of the area.

<nLeftcolumn> Designates the column for the top-left corner the area.

<nBottomline> Designates the line for the bottom-right corner of the area.

<nRightcolumn> Designates the column for the bottom-right corner of the area.

<cNewcharacter|nNewcharacter> Designates the new character for the screen area. Specify the parameter as a numeric in the range of 0 to 255 or as a character string. The default value is the CLEARB.

<cOldcharacter|nOldcharacter> Designates which character to exchange. Specify the parameter as a numeric in the range of 0 to 255 or as a character string. The default is to exchange all characters.

() When no parameter is designated, the function replaces all characters in the screen area with CLEARB.


The function always returns a null string.


Within a screen area, CHARWIN() replaces all characters or just a particular character with a new one. If <cNewcharacter|nNewcharacter> is not designated, the function uses the character set with SETCLEARB(), where the preset value is CHR(255). The upper-left and lower-right corner rows and columns are given for the borders of the area. If these arguments are missing, then the entire screen area is exchanged.


       .  Exchange all characters for CLEARB:
              SETCLEARB("X")       // Exchanges within CHARWIN() entire screen
           .  Exchange all "A" for "B":
              CHARWIN(10, 10, 20, 70, "B", "A")    // Always returns a ("") null
                                                   // string
           .  Numeric characters can also be designated:
              CHARWIN(10, 10, 20, 70, 66, 65)      // A = 65, B = 66

See also

SETCLEARB(), COLORWIN(), Introduction

Introduction Video Functions


 Working With Video Functions

     This module discusses video functions that are either directly or
     indirectly concerned with the screen.  Included are all functions that
     deal with such screen adapters as CGA, EGA and Hercules.  Different
     modes on various adapters are supported, such as a 40-column CGA, a 43-
     line EGA, or a 50-line VGA.


     Many of the functions in this chapter depend on setting the DSETWINDOW()
     switch.  This switch determines if the screen output of external
     programs, as well as DOS, are redirected to a window.
     Clipper Tools output functions are also valid as external.  If the
     default setting in DSETWINDOW() is .T. or on, this rerouting is carried
     out.  Some functions will then return inaccurate, or at the very least,
     different results.  Examples of this are ISANSI() or NUMCOL()


     Many of the functions in this module work with color attributes
     designated as parameters.  These arguments are carried out in three
     different ways:

     A numeric value, which corresponds to a combined color attribute
     (e.g., 7).

     A string in the "NN/NN" form, with two specified numeric values (e.g.,

     A string in the "CC/CC" form, with two specified attributes are
     designated in the form Clipper requires (e.g., "W/N").

     With many functions, the attribute returns a combined numeric value.
     Attributes for the foreground and background are tied together this way.

     Color attributes are constructed as follows:

     Bit                8 7 6 5        4 3 2 1
     Attribute          * R G B        + R G B
           _ _ _ _ _ _  /   _ _ _ _ _ _

           Background   /   Foreground

     Each attribute consists of four bits, which represent a value in the
     range of 0 to 15.  Therefore, there are a total of 16*16, or 256,
     different values from 0 to 255.  These numeric values can be changed
     into the "nn/nn" format, that can be used under Clipper with the
     NTOCOLOR function.  However, it is possible to directly influence this
     combined attribute value.  The following examples show this and relate
     back to the chapter on number and bit manipulation:

     NUMOR( nattr, 128)    // Flashing on
     NUMAND(nattr, 127)    // Flashing off
     NUMXOR(nattr, 128)    // Change flashing
     NUMOR(nattr,  8)      // High intensity on
     NUMAND(nattr, 247)    // High intensity off
     NUMXOR(nattr,  8)     // Switch high intensity

 Special Parameter Type

     With many functions, a parameter may be of the <mIcCharacter|nCharacter>
     type (e.g., an individual character).  This can occur in two different

     Numerically, as the ASCII code of the desired character (e.g., 7).

     Alphanumeric as the character (e.g., ":").

     Because of this, you must not use the CHR() function to change special


     Some of the Clipper Tools functions use a standard attribute and
     character to  delete lines or screen areas.  This attribute is described
     as CLEARA; the character as CLEARB.  You can query both CLEARA and
     CLEARB with the corresponding functions.  At the same time, certain
     preset values are in effect for CLEARA and CLEARB.  The attribute "W/N"
     is the standard preset for CLEARA, while CHR(255) is the character used
     for CLEARB.  If you use this character for CLEARB, it fills the
     background with the corresponding color for every deletion on every
     screen adapter.

     Use the following functions to set standard values for CLEARA and


     If you use the SETCLEARx() functions in conjunction with the
     corresponding parameters (<Attribute> or <Character>), the currently
     existing default value is replaced by a parameter.

 Clipper Functions and Commands Which Delete

     If you use the Clipper Extended Drivers, CHR(255) is used instead of
     a space for all Clipper functions and commands that delete the screen
     in one way or another (see CLEARB).  A CHR(255) is helpful on many
     screen adapters, since in contrast to a space, you can assign it a
     color.  Then, the screen will not appear so fuzzy.

     More precisely, the functions and commands concerned always use the
     delete character set by SETCLEARB(), which uses CHR(255) as the default
     setting.  If you want to use a space to clear in Clipper or
     Clipper Tools, insert a SETCLEARB(32) into the program.

     Re-implement a space for clear:

        CLEAR         // The affected Clipper command

 Video Modes

     Occasionally, there is some confusion about video modes.  You will not
     be able to work in EGA mode just because your computer has an EGA
     adapter built into it.  By the same token, you will not get either EGA
     or VGA modes, if you do not work with graphics.

 EGA43 / VGA50 / VGA28, etc.

     In this section, the concern is not to just get a mode "hardwired"' into
     a card, but for Clipper Tools it is to generate corresponding fonts
     and other settings.  For these reasons, the GETMODE() and GETSCRMODE()
     functions generate their own values that are greater than 255.

     For example, changes to the screen mode concerned with line count can be
     combined with a 40-column mode:

     EGA43()          // 43 lines and 40 columns

 Video Functions and Windows

     You cannot implement functions that change the base address for screen
     memory while windows are open.  This includes all mode changes, as well


      Since this section is about DOS-TEXT mode programming, considered as obsolete and details skipped.

Tools – Video Functions

Introduction Video Functions
CHARPIX()    Returns the number of pixel lines per character
CHARWIN()    Exchanges particular characters in a screen area.
CLEAREOL()   Clears from the cursor position to the end of line
CLEARSLOW()  Deletes a screen area from the outside in with a delay
CLEARWIN()   Clears a screen area
CLEOL()      Clears characters and attributes to the end of a line
CLWIN()      Clears character and attribute from a screen area
COLORREPL()  Exchanges particular screen attributes
COLORTON()   Converts NN/NN or CC/CC color values into numeric values
COLORWIN()   Exchanges particular attributes in a screen area
EGAPALETTE() Changes EGA palette colors
ENHANCED()   Selects the enhanced color value for SET COLOR TO output
FILESCREEN() Reads screen content from a file
FONTLOAD()   Loads EGA/VGA fonts from another file
FONTRESET()  Resets all font and palette changes to the ROM defaults
FONTROTATE() Rotates and mirrors images within a font string
FONTSELECT() Determines font areas for normal- and high-intensity output
GETCLEARA()  Queries the current attribute for the clearing functions
GETCLEARB()  Queries the default character for the clearing functions
GETFONT()    Queries the current font
GETSCRSTR()  Queries screen output that was redirected by SETSCRSTR()
GETVGAPAL()  Determines the palette settings on a VGA card
INVERTATTR() Inverts the foreground and background of an attribute
INVERTWIN()  Inverts all attributes in an area of the screen
ISCGA()      Tests for presence of a CGA card or if one can be emulated
ISEGA()      Determines if an EGA card is present or can be emulated
ISHERCULES() Determines if a HERCULES card is present or can be emulated
ISMCGA()     Determines if an MCGA card is present or can be emulated
ISMONO()     Determines if a monochrome card is present or can be emulated
ISPGA()      Determines if a PGA card is present or can be emulated
ISVGA()      Determines if a VGA card is present
MAXFONT()    Determines the number of available fonts
MONISWITCH() Switches between monochrome and color screen
NTOCOLOR()   Converts a numeric value into a color value
NUMCOL()     Restores the number of available screen columns
RESTCURSOR() Restores a saved cursor position and form
SAVECURSOR() Saves current cursor position and form
SAYDOWN()    Displays screen output downward and vertically
SAYMOVEIN()  Displays screen output with a "move in" effect
SAYSCREEN()  Output to the screen without changing the attribute
SAYSPREAD()  Displays screen output with "spread" effect
SCREENATTR() Determines the attribute at a particular position
SCREENFILE() Writes screen content to a file
SCREENMARK() Searches for a string and marks it with an attribute
SCREENMIX()  Mixes characters and attributes of a screen
SCREENSIZE() Queries the number of characters that can be displayed
SCREENSTR()  Reads a string, including attributes, from the screen
SETCLEARA()  Changes the default attribute for screen clear
SETCLEARB()  Changes the default character for screen clear
SETFONT()    Loads the font directly out of a string
SETRC()      Sets line and column for the CA-Clipper cursor
SETSCRSTR()  Redirects screen output into a string
STANDARD()   Selects the standard color value for SET COLOR TO output
STRSCREEN()  Displays a string with characters and attributes on the screen
UNSELECTED() Selects the unselected color value for SET COLOR TO output
UNTEXTWIN()  Replaces an area of characters from a region of the screen
VGAPALETTE() Changes VGA palette colors
VIDEOINIT()  Reinitializes a video system after a RUN
VIDEOSETUP() Queries video mode at system start
VIDEOTYPE()  Returns bit-coded information about available video modes