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
A numeric value, which corresponds to a combined color attribute
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
CLEARA and CLEARB
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
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
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
as SETPAGE and SETSCRSTR.
Since this section is about DOS-TEXT mode programming, considered as obsolete and details skipped.