Color Inheritance
It is possible to explicitly define background and foreground colors for most objects. If you do not explicitly define a color, the actual color used depends on the type of object, and on the Inherit Colors and Transparency properties (where applicable).
When the Inherit Colors (InheritColor) property is available and set to True
, the object
inherits its colors from its parent. This is also the default behavior for entities and area
frames, TabEx widgets, and contained forms.
The Transparency property, which is available on some widgets, also affects the color that the user sees at runtime.
Object | BackColor property? | ForeColor property? | InheritColors property? | Default Color Inheritance | Transparency property? |
---|---|---|---|---|---|
Check Box | Yes | Yes | Yes | Windows | Yes |
Color Box | Yes | Yes | No | Windows | No |
Color List | Yes | Yes | No | Windows | No |
Combo Box | Yes | Yes | No | Windows | No |
Command Button | Yes | Yes | No | Windows | Yes |
Drag-and-Drop | Yes | Yes | No | Windows | No |
Drop-Down List | Yes | Yes | No | Windows | No |
Edit Box | Yes | Yes | Yes | Windows | Yes |
Form Container | No | No | No | Parent | No |
HTML Widget | No | No | No | Windows | No |
Hyperlink | Yes | Yes | No | Windows | Yes |
List Box | Yes | Yes | No | Windows | No |
Map | Yes | Yes | No | Windows | No |
Meter | Yes | Yes | No | Windows | No |
Month Calendar | Yes | Yes | No | Windows | No |
OCX Container | Yes | No | No | Windows | No |
OLE Container | Yes | No | No | Windows | No |
Output Box | Yes | Yes | No | Windows | No |
Picture | Yes | Yes | No | Windows | Yes |
Progress Bar | Yes | Yes | No | Windows | No |
Radio Group | Yes | Yes | Yes | Windows | No |
Spin Button | Yes | Yes | No | Windows | No |
Tab | No | No | No | Windows | No |
TabEx | Yes | Yes | No | Parent | No |
Tree | Yes | Yes | No | Windows | No |
Grid | No | No | No | Parent | No |
Object | BackColor property? | ForeColor property? | InheritColors property? | Default Color Inheritance | Transparency property? |
---|---|---|---|---|---|
Label | Index color 1 | Index color 1 | Yes 2 | Windows | Yes 3 |
Entity | Yes | Yes | No 4 | Parent | No 4 |
Area Frame | Index color 1 | Index color 1 | No 4 | Parent | No 4 |
Form | Yes | Yes | No | Windows | No |
Form in Form Container | Yes | Yes | No 5 | Parent | No |
Form in Tab | Yes | Yes | No | Windows 6 | No |
Form in TabEx | Yes | Yes | No 5 | Parent | No |
Menu | Yes | Yes | No | Windows | No |
|
Search Order for Colors
When color inheritance is applied, Uniface uses the first color definition it encounters in the following search order:
- Widget or label itself
- Each entity or area frame, starting from the innermost to the outermost.
- Form
- If the Form is a Contained Form in a FormContainer or TabEx widget, the search continues to the parent widget, and follows the rest of the search order until the outermost form.
- If the Form is a Contained Form in a Tab widget, the search stops. (By default, the Tab widget has a white background, so the Contained Form inherits this.)
- The default color as defined by Windows.
Note the following:
- If the Color property
is set to an index color, it is treated as if the BackColor and
ForeColor properties were set.
Caution: If both an index color and BackColor or ForeColor properties are set on the same object, the results are unpredictable.
- If an object has overlapping parents, for example, when a widget is partially inside an area frame, the parent is the object that contains the widget's top-left corner.
- If an Edit Box has the
EntColor property set to
True
, it takes precedence over Inherit Colors.