Skip to main content
Version: 20 R7 BETA

SCREEN DEPTH

SCREEN DEPTH ( depth ; color {; screen} )

ParameterTypeDescription
depthIntegerDepth of the screen (number of colors = 2 ^ depth)
colorInteger1 = Color screen, 0 = Black and white or Gray scale
screenIntegerScreen number, or main screen if omitted

This command is not thread-safe, it cannot be used in preemptive code.

Description

The SCREEN DEPTH command returns in depth and color information about the monitor.

The depth of the screen is returned in depth. The depth of the screen is the exponent of the power of 2 expressing the number of colors displayed on your monitor. For example, if your monitor is set for 256 colors (2^8), the depth of your screen is 8.

The following predefined constants are provided by 4D:

ConstantTypeValue
Black and whiteInteger0
Four colorsInteger2
Millions of colors 24 bitInteger24
Millions of colors 32 bitInteger32
Sixteen colorsInteger4
Thousands of colorsInteger16
Two fifty six colorsInteger8

If the monitor is set to display in color, 1 is returned in color. If the monitor is set to display in gray scale, 0 is returned in color. Note that this value is significant on the Macintosh platform.

The following predefined constants are provided by 4D:

ConstantTypeValue
Is colorInteger1
Is gray scaleInteger0

The optional parameter screen specifies the monitor for which you want to get information. If you omit the screen parameter, the command returns the depth of the main screen.

Example

Your application displays many color graphics. Somewhere in your database, you could write:

 SCREEN DEPTH($vlDepth;$vlColor)
 If($vlDepth<8)
    ALERT("The forms will look better if the monitor"+" was set to display 256 colors or more.")
 End if

See also

Count screens