Back to DAL Enhancements

SETCOLOR

Use this procedure/function to change the color property assigned to a given field. You can use SetColor on any field including multiline text fields and bar code fields (to change the color of the bars).

Syntax: SetColor (PrefixName, Field, Section, Form, Group)

Parameter Description Required
PrefixName A prefix name to be associated with the color attributes to set for this section. The sub-attributes are “.red”, “.green”, “.blue”, and “.options” which should be appended to the prefix name. Yes
Field The name of a field within the section. Defaults to the current Field
Section The name of an existing section in the form set. Defaults to the current Section
Form Name of a form within the form set that contains the section. Defaults to the current Form
Group Name of the form group that contains the form and section. Defaults to the current Group

This sets the section text color by using the PrefixName parameter to find the associated color attribute values:

  • prefixName.red
  • prefixName.green
  • prefixName.blue
  • prefixName.options

Document colors are managed by using a RGB (red, green, blue) value combination. Each color component can be in the range of 0 to 255. The combination of the values determines the overall colors. If all color components are set at 0, the color is black. Similarly, if all are set at 255 that represents the white color. By adjusting the red, green, and blue components, you can create any color in the rainbow.

The “.options” value determines what the section does with your new color assignment.

0 = return the field to have the default field color. The red, green, blue attribute values are ignored.
1 = assign the color to be visible when viewing the section.
3 = assign the color to be visible and to also indicate to print this color when creating output (if supported by the output type).

Examples:

Procedure Result
  • MyColor.red = 128
  • MyColor.green = 0
  • MyColor.blue = 0
  • MyColor.options = 1
  • SetColor ("MyColor")
Assigned a new color to the current field. Explanation: When the options value is 1, the color is assigned the red, green, and blue values and this color will be visible when the document is displayed in an entry system.
  • MyColor.options = 0
  • SetColor ("MyColor")
Reset the field to use the default system field color. Explanation: When the options value is 0, the section color is reset to the default for fields. If the other color options (red, green, blue) are set within the prefixed name, these are ignored.
  • Color.red = 128
  • Color.green = 128
  • Color.blue = 128
  • Color.options = 3
  • SetColor ( "color", "term", "MVF", "XYZ")
Assign a color to the field with options to display and print with that color. Explanation: The field "term" found on section MVF on the form XYZ is assigned the color values. Options=3 means the color is visible during entry and will also print when Send Color is specified for print.

Take note in the examples how the prefixName parameter must be specified as a string value. That is why the parameter has quotes around the prefixed name.

NOTE: When changing the color of a field, this will set the entire section to be inlined to preserve the color change if saved to WIP or Archive.