Defining Colors for Your Form and Controls

How to:

Several control properties enable you to change the color of various aspects of your control, such as the background color, border color, text color, row color (in HTML Tables), and so on. You use the Color well to assign colors to all of these properties.

Following is a list of properties that assign colors. For more information on these properties, see Form and Control Properties Reference.

If a control has any of these attributes set to Default, then it uses the color settings for BackColor and ForeColor for the form itself unless it is one of the following:

You can assign one of the twenty colors in the Colors box, or you can click Other to open the Colors dialog box, where you can assign one of forty-eight pre-defined colors or define your own custom color.

Note: You can also assign colors using a Cascading Style Sheet. If your form has a Cascading Style Sheet, setting any color property to Default means that WebFOCUS Maintain will look in the style sheet for the color to use. If you set any color property to anything other than Default, then WebFOCUS Maintain will use that setting. For more information on Cascading Style Sheets, see Using Cascading Style Sheets.


Top of page

x
Procedure: How to Add Colors
  1. Select the control or form.
  2. Click the button on the left of the selected property box in the property sheet.

    The Color drop-down list box opens.

  3. Select one of the colors in the box.

    or

    Click Other to select one of the basic colors.

  4. Click OK to apply the color.

Top of page

x
Procedure: How to Define Custom Colors
  1. Click Other in the Color box.
  2. Select one of the basic colors from the Basic Color chart.
  3. Click or drag the arrow on the side of the Color Box to change the current color displayed in the Color|Solid box.

    or

    Type the desired values in the boxes below the Color Box. The boxes on the left use hue, saturation, and luminosity. The boxes on the right use the three primary colors used by color monitors: red, green, and blue.

  4. Click the Add to Custom Colors button.

    The color is added to the Custom Colors chart on the left.

  5. Click the desired color from the Custom Colors chart. A dotted line borders the chosen color.
  6. Click OK to apply the color.

For more information on using the Colors dialog box, click the question mark next to the close box and then click on any element in the dialog box.


Top of page

x
Syntax: How to Set the Value of a Control Color Property

To set the value of a form or control color property, use the following syntax

[Winform Show_Inactive form;]form.[control.]SETcolorproperty(amount_of_red, amount_of_green, amount_of_blue);

where:

Winform Show_Inactive

Is required if the form is not currently the active form.

form

Is the name of the form, determined by the (Name) property.

control

Is the name of the control, determined by the (Name) property.

colorproperty

Is the name of the color property (BackColor, ForeColor, and so on).

amount_of_red, amount_of_green, amount_of_blue

Defines the color by the amount of red, green, and blue (RGB) present in the color. For more information on how these colors work, open the Colors dialog box, click the question mark next to the close box, and then click Red, Green, or Blue.

Note: You can easily generate this syntax by selecting the property in the property sheet and dragging it to the Procedure Editor or the Event Handler editor.


WebFOCUS