Method AutomationObject():translateColor() Foundation

Translates a COM/ActiveX color value to an Xbase++ color and vice versa

:translateColor( <nColor>, <lIsOLEColor> ) --> nColor
The color value to be translated. This may either be a COM/ActiveX color or an Xbase++ color value.
This parameter specifies whether the color in <nColor> is a COM/ActiveX or an Xbase++ color value. If .T. (TRUE) is passed for this parameter, <nColor> is assumed to contain a COM/ActiveX color value.

The method returns the translated equivalent to the color value passed. Depending on the value contained in the <lIsCOMColor>parameter, the return either is a COM/ActiveX or an Xbase++ color value.


ActiveX object and controls use a different color format than Xbase++ does. To assign an Xbase++ color value to a COM/ActiveX property, the class method:translateColor() must be used to convert the color before it is assigned to the property. Likewise, if a color value is returned as the return value of a COM/ActiveX method, it must be converted before it can be assigned as the background color for an Xbase Part for example.

The color to be converted is specified in the <nColor> parameter. To translate an Xbase++ color value, the application may pass one of the colors defined in the file GRA.CH (GRA_CLR_xxx), a system color (see XBPSYSCLR_xxx in file XBP.CH), or it may use the GraMakeRGBColor() function to create an RGB-encoded color value. If an Xbase++ color is translated, :translateColor()returns the equivalent COM/ActiveX color value. This value can be used with AutomationObject:setProperty(), for example.

If a COM/ActiveX color value is translated and .T. is passed in parameter <lIsOleColor>, the function returns an Xbase++ color as an RGB-encoded color value. RGB-encoded color values can be used with the Graphics Engine and Xbase Parts. The function GraGetRGBIntensity()can be used to determine the intensities of the individual color guns.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.