GetCellColor

Retrieve the color of an individual cell

WTSupported in traditional Synergy on Windows

 

 

 

status = %AX_CALL(axlist_id, "GetCellColor", row, column, foreground_color,
&       background_color)

Return value

status

Returns true if successful, otherwise false. (n)

Arguments

axlist_id

The ID for the ActiveX Toolkit list. This ID can be retrieved with L_STATUS. (n)

row

The row number of the cell whose color is being retrieved. (n)

column

The column number of the cell whose color is being retrieved. (n)

foreground_color

The returned text color (RGB value) of the cell. (n)

background_color

The returned background color (RGB value) of the cell. (n)

Discussion

The GetCellColor method retrieves the foreground (text) and background color for a specified cell as RGB values.

An RGB value is a four-byte integer value that includes the red, green, and blue components of a color:

^X(00bbggrr)

where bb, gg, and rr are intensity values in the decimal range 0 through 255 (00 through FF in hexadecimal) for the blue, green, and red color components. This value can be stored in other numeric types (decimal, for instance), but the variable must be large enough to hold at least a value of ^X(FFFFFF) or truncation may occur.

Toolkit includes macros (defined in DBLDIR:activex.def) that make it easier to use these values:

There’s no reason to use the RGB_VALUE macro with this method, but the RED_PART, GREEN_PART, and BLUE_PART macros are convenient for extracting red, green, and blue values from foreground_color and background_color.

See also

Examples

The following example brightens the background color of the fourth column in the currently selected row by approximately 50%.

xcall l_status(listid, D_LAXCTRL, axctrl, D_LCURITM, curr)
xcall ax_call(axctrl, "GetCellColor", curr, 4, fgcolor, bgcolor)
red = RED_PART(bgcolor)
green = GREEN_PART(bgcolor)
blue = BLUE_PART(bgcolor)
                    ;Compute average distance from brightest possible
avgdelta = ^x(FF) - ((red + green + blue) / 3)
avgdelta /= 2       ;Multiply by 50%
red += avgdelta     ;Brighten each color by that amount
if (red .gt. ^x(FF) ; or as bright as possible
  red = ^x(FF)
green += avgdelta
if (green .gt. ^x(FF))
  green = ^x(FF)
blue += avgdelta
if (blue .gt. ^x(FF))
  blue = ^x(FF)
xcall ax_call(axctrl, "SetCellColor", curr, 4, RGB_VALUE(red,green,blue), 1)