Member variable XbpColumn():colorBlock Foundation

Changes the color of cells depending on displayed data.

Attribute: EXPORTED
Data type: Code block | NIL

A code block can be assigned to the :colorBlock instance variable. It receives as argument the value of the current cell before it is displayed. This is the return value of the :dataLink code block. The column object and the row number of the cell are passed to the code block as additional arguments. Depending on these parameters, the :colorBlock code block can be used to define the color of the current cell. For this it must return a two-element array containing constants to define foreground and background color. Generally, the code block looks like this:

{|xValue,oCol,nRow| IIf( <lExpression>,             ; 
                         {<nColorFG1>,<nColorBG1>}, ; 
                         {<nColorFG2>,<nColorBG2>}  ) } 

In addition to the normal colors of a cell, the colors of a highlighted cell can be specified via the code block in :colorBlock. To do this, a four-element array must be returned by the code block. The third and fourth array elements specify the foreground and background color of the cell when it is highlighted. A code block manipulating the normal as well as the highlight colors generally looks like this:

{|xValue,oCol,nRow| IIf( <lExpression>,                          ; 
                         {<nColorFG1>,       <nColorBG1>,        ; 
                         {<nColorFG2>,       <nColorBG2>,        ; 
                          <nColorFG2Hilight>,<nColorBG2Hilight>} ) } 

Constants prefixed with GRA_CLR_ or XBP_SYSCLR_ are used to define a color. Alternately, one element of the returned array may contain the value NIL. In this case, the forground or background color, respectively, remains unchanged in the current cell. This makes it possible, for example, to change only the foreground color.


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.