The NUM–ENTRIES attribute sets and returns the number of colors available in the color table. The following methods allow you to read existing color definitions and to set new definitions for dynamic colors:
The GET–RED–VALUE(n), GET–GREEN–VALUE(n), and GET–BLUE–VALUE(n) methods let you read the red, blue, and green values for a specified color number. This example gets the red value of the 16th color in the color table:
DEFINE VARIABLE red-val AS INTEGER NO-UNDO.
red-val = COLOR-TABLE:GET-RED-VALUE(16)
You can determine whether a color is dynamic by reading the GET–DYNAMIC(n) method. You can make a color dynamic or nondynamic by using the SET–DYNAMIC(n, logical) method. This example makes color 16 dynamic if it is not already set:
IF NOT COLOR-TABLE:GET-DYNAMIC(16) THEN
COLOR-TABLE:SET-DYNAMIC(16, TRUE).
You can change the red, blue, and green values of a dynamic color by using the SET–RED–VALUE(n, integer), SET–GREEN–VALUE(n, integer), and SET–BLUE–VALUE(n, integer) methods. Note that these methods change the effective color values of a color number in the current color table. Thus, every visible widget set to the specified color number changes to the corresponding colors immediately. However, this does not change the color definitions originally specified in the current environment. If you restart the application with the current environment, the original colors reappear. This example sets color 16 to a blue value of 192:
COLOR-TABLE:SET-BLUE-VALUE(16, 192).
There is an efficient alternative to calling the SET–RED–VALUE(n, integer), SET–GREEN–VALUE(n, integer), and SET–BLUE–VALUE(n, integer) methods to change the RGB values of a dynamic color. You can specify the SET–RGB–VALUE() method to substitute for all three of these methods. You can determine a combined RGB value using the RGB–VALUE function or by accessing a color property from an ActiveX control. For example:
The GET–RGB–VALUE() method returns an INTEGER that represents a combination of the red, green, and blue values associated with the nth entry. This combined RGB value is most useful for setting colors in an ActiveX control.
For more information on the COLOR–TABLE handle, see OpenEdge Development: ABL Reference.