Background Color (BackColor)

Color to use as the background of the object.

"BackColor=ColorName | HexColorNumber | RGBColor"

Value Description
ColorName Name of a web color or system color. For more information, see Standard Colors .
HexColorNumber Hexadecimal number (prefixed by a hash mark) of a color. For example: #D90E1A.

RGBColor

RGB (Red Green Blue) numeric values in the form R,G,B. For example 255,0,0

Usage

Dynamic? Yes for widgets, No for other objects
Supported in Grid? Depends on widget
Dependencies: Depends on widget. See Limitations

Description

Uniface follows Windows behavior in applying colors. Depending on the Windows version and the object, the color may not always be applied. For example, the color determined by the theme may take precedence over the foreground and background color values of widgets.

When set dynamically, all widgets accept the property, but some will ignore it. For example, the command button color cannot be changed.

For menus, panels, and area frames, this is a static property that can only be set in the initialization file (usys.ini). For more information, see Menu and [areaframes].

For forms and application shells, this property is a static property that can only be set in ProcScript before the shell or component is displayed. For forms, use $windowproperties. For application shells, use $applproperties. For more information, see $windowproperties and $applproperties.

Setting in ProcScript

The BackColor property can be set dynamically in ProcScript for all objects except menus and panels. For menus and panels, color properties are set in the initialization file (usys.ini).

ProcScript for Setting Colors
Object ProcScript Remarks
Widgets $fieldproperties All widgets accept the property, but some will ignore it; for example, the Windows button color cannot be changed.
Fields $properties  
Entities $entityproperties  
Forms $windowproperties BackColor has no effect if a background image is defined for the form.
Application shells $applproperties  
Menus N/A BackColor can only be set in usys.ini.
Panels

Limitations

Caution: Do not combine the use of Uniface index colors with the Foreground and Background properties. This is not supported and can lead to unexpected results.

For example, if you have set the Foreground and Background colors, you should not use curoccvideo or fieldvideo because these statements set an index color. When the item loses focus, the color is restored to the default index color, not to the Foreground and Background colors.

In some circumstances, this property is not supported:

  • Forms—property has no effect if a background image is defined for the form.
  • Command Button—supported only when Representation is set to Uniface.
  • Check Box—only supported for the label color, not the checkbox itself.
  • Hyperlink—supported only when Transparency is switched off
  • OCX Container—always overlapped by OCX control
  • Radio Group—supported only for the labels and the label area.

Setting Widget Colors in ProcScript

The following code example builds a list of properties (vProperties) and assigns them to the widget of field FLD1:

putitem/id vProperties,"backcolor","lightskyblue"
putitem/id vProperties,"forecolor","#000000"
$entityproperties(FLD1)=vProperties

The widget now has a light blue background and black foreground (text).

Related Topics