I am using some code from an old working program using xBrowse .. I have a defined column "Status" which maps back to a recordset field named FANSWER. Here is the code .. I want to color the "Status" ( oRsTrav:Fields("FANSWER"):Value ) column with either Red, Green or Yellow based on three possibilities ..
Code: Select all
// EMployee browse -----------------------
REDEFINE xBROWSE oLbxB ;
RECORDSET oRsTrav ;
COLUMNS "PERSNO", ;
"EMPLOYEE", ;
"EVENT", ;
"LOCATION", ;
"SPONSOR", ;
"FANSWER", ;
"GRANDTOT " ;
COLSIZES 85,135,135,135,135,85,100 ;
PICTURE "","", "", "", "", "", "999,999.99";
HEADERS "Persno", ;
"Employee Name", ;
"Event Name", ;
"Location", ;
"Sponsor", ;
"Status", ;
"Total" ;
ID 132 of oGrps ;
AUTOCOLS FOOTERS LINES CELL
* oLbxB:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbxB:lRecordSelector := .f.
oLbxB:lFooter := .t.
oCol1 := oLbxB:aCols[ 1 ]
oCol1:bFooter := { || Ltrim( Str( oLbxB:KeyNo() ) ) + " / " + LTrim( Str( oLbxB:KeyCount() ) ) }
oLbxB:bChange := { || oCol1:RefreshFooter() }
oLbxB:bClrGrad := { | lInvert | If( ! lInvert, ;
{ { 0.50, 15790320, 15790320 }, ;
{ 0.50, 15790320, 15790320 } }, ;
{ { 0.50, 15790320, 15790320 }, ;
{ 0.50, 15790320, 15790320 } } ) }
if(oRsTrav:eof, ,oLbxB:oCol( "Status" ):bClrStd := ; // <--- here
{ || HB_Decode( AllTrim( oLbxB:oCol("Status"):value ), ;
"APPROVED", { CLR_BLACK, CLR_HGREEN }, ;
"OPEN", { CLR_BLACK, CLR_YELLOW }, ;
"REJECTED", { CLR_WHITE, CLR_HRED } ) } )
Thanks
Rick Lipkin