Colours

Applicable to

bgc | fgc = rgb_value

OLE controls, windows. Also valid clauses for the put command.

data_bgc | data_fgc = rgb_value

groups, listboxes, tables, textboxes, windows

label_bgc | label_fgc = rgb_value

buttons, graphics, groups, listboxes, static text, tables, textboxes, windows

title_bgc | title_fgc = rgb_value

tables

caption_bgc | caption_fgc = rgb_value

windows

line_fgc = rgb_value

tables

transparent = rgb_value

buttons, graphics, button groups, windows

Contents

Colour clauses enable precise RGB definitions of the colours to be used in the display of windows and window controls. They are most commonly used to define the background and foreground colours used in the display of textual information. Background colour clauses have the suffix _bgc; foreground colour clauses have the suffix _fgc. Different types of control use a different selection of clauses.

Colours can be defined at window level. All controls in the window will use these window defaults except in those cases where a different value is assigned at control level, or, in the case of grouped controls, at group level. A group colour definition takes precedence over a window colour definition; a control colour definition takes precedence over a group definition.

A background colour may be defined without the corresponding foreground colour (and vice versa); they are entirely separate clauses. Sculptor uses the default for whichever colour was not defined.

The transparent = clause is only relevant to image buttons (push buttons which have an image assigned) and to graphic images. It defines a colour to be made transparent, allowing the window background to show through. A default transparent colour can be defined at window level.

The values for colour clauses are normally assigned by means of the Sculptor program designer. This program also enables the setup and selection of custom colours for a project. See Program designer colours.


RGB colours

The standard include file rgb.h contains extensive definitions for colours in 24-bit RGB form. The definitions have the prefix RGB_, and are available for use in all colour clauses. The program $SCULPTOR/demo/controls/colours.f demonstrates all the colours included in rgb.h.

An RGB value has the form 0x80bbrrgg, where bb is blue intensity, rr is red intensity and gg is green intensity. This is the colour order required by Microsoft functions.

The most significant byte of each value contains option flags. The top bit (0x80xxxxxx) must be set to activate the colour. This is a Sculptor feature that makes it possible to switch pre-defined colours on and off by setting or clearing the top bit. The definitions RGB_ACTIVATE and RGB_INACTIVE are provided for the purpose of switching colours on and off. To switch a colour on or off, use the forms:

colour = colour | RGB_ACTIVATE

Switch a colour on

colour = colour & RGB_INACTIVE

Switch a colour off

Note

If an RGB colour is not active it is not used. The default colour is used instead.

The special value RGB_DEFAULT can be used in a colour clause to select the user’s default preference instead of the inherited colour:

colour = RGB_DEFAULT

The default is the colour defined for the purpose in the current Windows display settings.


EXAMPLES

label_fgc = RGB_CORNFLOWERBLUE
bgc = 0x80C8C4B8
data_bgc = RGB_HONEYDEW
line_fgc = 0x80808040  /* table line colour */

RELATED TOPICS

Property clauses