COLORING ROWS IN A GRID

Submitted to VFUG November1999 Newsletter

I find coloring rows in a grid a useful way to indicate possible needs for
action.  The examples I have found on "DynamicBackColor"  have been limited
to such things as changing the color of every other row  (like accounting
paper!).

The following logic placed in the INIT of a grid can be used to color rows
for a variety of conditions.  In the example the rows are colored depending
on the dates of records in the  grid.  In other grids the condition is the
field  STATIS  of the record.  The only problem is keeping track of the
parenthesis  at the end  ... one more than the number of conditions.  Also
the length  of the  statement is limited.  The values inside RGB() can be
what ever the users display supports.   

*  can only next IIF 4 deep ??? 244 CHARACTER LIMIT
   THISFORM.GRID1.SETALL("DynamicBackColor", ;
        "IIF(date() > saildate+21,RGB(255,0,0),;
         IIF(date() > saildate+7 ,RGB(255,255,0),;
         IIF(date() = saildate    ,RGB(100,255,255),; 
         IIF(date() > saildate-7 ,RGB(0,255,0),;
         rgb(255,255,255) ))))","Column")
 
* The DynamicForeColor might be changed to assure good contrast with the
background.
    
   THISFORM.GRID1.SETALL("DynamicFOREColor", ;   
     "IIF( v_stat = 'B',RGB(255,255,255),;
      IIF( v_stat = 'P',RGB(0,0,0),;
      IIF( v_stat = 'R',RGB(0,0,0),;  
      rgb(0,0,0) )))","Column")

Phil Bartow
Bartow Associates, Inc