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

version 6.0 (Modified)


SET COLOR ({*; }object; color)

ParameterTypeDescription
*If specified, Object is an Object Name (String)
If omitted, Object is a Field or a Variable
objectField or variableObject Name (if * is specified), or
Field or Variable (if * is omitted)
colorNumberNew colors for the object

Description

The command SET COLOR sets the foreground and background colors of the form objects specified by object.

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.

The color parameter specifies both foreground and background colors. The color is calculated as:

Color:=–(Foreground+(256 * Background))

where foreground and background are color numbers (from 0 to 255) within the color palette.

Color is always a negative number. For example, if the foreground color is to be 20 and the background color is to be 10, then color is – (20 + (256 * 10)) or –2580.

Note: You can see the color palette in the Form Editor's Object Properties window.

The numbers of the commonly used colors are provided by the following predefined constants:

ConstantTypeValue
WhiteLong Integer0
YellowLong Integer1
OrangeLong Integer2
RedLong Integer3
PurpleLong Integer4
Dark BlueLong Integer5
BlueLong Integer6
Light BlueLong Integer7
GreenLong Integer8
Dark GreenLong Integer9
Dark BrownLong Integer10
Dark GreyLong Integer11
Light GreyLong Integer12
BrownLong Integer13
GreyLong Integer14
BlackLong Integer15

Note: While SET COLOR works with indexed colors within the default 4D color palette, version 6 introduces the command SET RGB COLORS, which allows you to work with any RGB color.

Example

The following example sets the color for a button named bInfo. The color is set to the values of the two variables named vForeground and vBackground:

   SET COLOR (bInfo; – (vForeground + (256 * vBackground)))

See Also

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