SET RGB COLORS

4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next

version 6.0


SET RGB COLORS ({*; }object; foregroundColor; backgroundColor)

ParameterTypeDescription
*If specified, Object is an Object Name (String)
If omitted, Object is a Field or a Variable
objectForm ObjectObject Name (if * is specified), or
Field or Variable (if * is omitted)
foregroundColorNumberRGB color value for Foreground color
backgroundColorNumberRGB color value for Background color

Description

The command SET RGB COLORS changes the foreground and background colors of the objects specified by object and the optional * parameters.

If you specify the optional * parameter, you indicate an object name (a string) in object. If you omit the optional * parameter, you indicate a field or a variable in object. In this case, you specify a field or variable reference (field or variable objects only) instead of a string. For more information about object names, see the section Object Properties.

You indicate RGB color values in foreground and background. An RGB value is a 4-byte Long Integer whose format (0x00RRGGBB) is described in the following table (bytes are numbered from 0 to 3, from right to left):

ByteDescription
3Must be zero if absolute RGB color
2Red component of the color (0..255)
1Green component of the color (0..255)
0Blue component of the color (0..255)

The following table shows some examples of RGB color values:

ValueDescription
0x00000000Black
0x00FF0000Bright Red
0x0000FF00Bright Green
0x000000FFBright Blue
0x007F7F7FGray
0x00FFFF00Bright Yellow
0x00FF7F7FRed Pastel
0x00FFFFFFWhite

Alternatively, you can specify one of the four automatic colors used by 4th Dimension for drawing objects whose colors are set automatically. The following predefined constants are provided by 4th Dimension:

ConstantTypeValue
Default foreground colorLong Integer-1
Default background colorLong Integer-2
Default dark shadow colorLong Integer-3
Default light shadow colorLong Integer-4

These colors (on a standard system) are shown here:

WARNING: On Windows, these automatic colors are system dependent. If you change your system colors in the Colors Windows Control Panel, 4th Dimension will adjust its automatic colors accordingly. Use the automatic color values for setting objects to the system colors, not for setting them to the example colors shown above.

Examples

This form contains the two non-enterable variables vsColorValue and vsColor as well as the three thermometers: thRed, thGreen, and thBlue.

Here are the methods for these objects:

      ` vsColorValue non-enterable Object Method
   Case of 
      : (Form event=On Load)
         vsColorValue:="0x00000000"
   End case 

      ` vsColor non-enterable variable Object Method
   Case of 
      : (Form event=On Load)
         vsColor:=""
         SET RGB COLORS(vsColor;0x00FFFFFF;0x0000)
   End case 
 
      ` thRed Thermometer Object Method
   CLICK IN COLOR THERMOMETER 

      ` thGreen Thermometer Object Method
   CLICK IN COLOR THERMOMETER 

      ` thBlue Thermometer Object Method
   CLICK IN COLOR THERMOMETER 

The project method called by the three thermometers is:

      ` CLICK IN COLOR THERMOMETER Project Method
   SET RGB COLORS(vsColor;0x00FFFFFF;(thRed << 16)+(thGreen << 8)+thBlue)
   vsColorValue:=String((thRed << 16)+(thGreen << 8)+thBlue;"&x")
   If (thRed=0)
      vsColorValue:=Substring(vsColorValue;1;2)+"0000"+Substring(vsColorValue;3)
   End if 

Note the use of the Bitwise operators for calculating the color value from the thermometer values.

In the User or Custom Menus environments, the form looks like this:



See Also

Bitwise Operators, SET COLOR.


4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next