Defining Color

You can define colors for dialogs and dialog elements. These can be foreground colors and background colors. To do this, you use the following attributes:

You can assign only standard colors to the attributes ending with NAME. The attributes ending on VALUE, however, can be assigned customized colors following the RGB model.

You can set colors:

  • in an attributes window, or

  • in event-handler code.

You can directly assign a value to the attributes ending with NAME. If you want to assign a value to an attribute ending with VALUE, you must set the NAME attribute to the value CUSTOM. If you do not set the NAME attribute to the value CUSTOM, the VALUE attribute is ignored.

Examples:

#DIA.BACKGROUND-COLOUR-NAME:= MAGENTA     /* Assign a value to a NAME 
                                          /* attribute 
#DIA.BACKGROUND-COLOUR-NAME:= CUSTOM      /* Set NAME to CUSTOM 
#DIA.BACKGROUND-COLOUR-VALUE:= H'FF0000'  /* Then assign Red, Green, and 
                                          /* Blue values to the VALUE  
                                          /* attribute (hexadecimal)

Note:
You can not use all customized colors in all parts of the user interface. Colors in text, for example, must always be monochrome.

When setting a color in an attributes window, you have three possibilities:

  • Use the attribute ending with NAME and leave the value at DEFAULT. You can also do this in code. Your color will then be determined by your color settings in the windowing system.

  • Use the attribute ending with NAME by pulling down the list box and choose one of the predefined colors.

  • Define your own color by using the attribute ending with VALUE.

Start of instruction setTo define a color

  1. Choose the Custom push-button control right of the Background color entry. A dialog box appears.

  2. Select one of the predefined colors or choose the Define Custom Colors push-button control. To set the red, green, and blue values, use the cursor to select the desired color or enter a value from 1 to 253 in the red, green, and blue value display fields.

  3. Choose the Add to Custom Color push button control. To save the newly defined color, choose the OK button in the dialog box. The newly defined color is now selected by default.

  4. To set it, close the attributes window.