by Rick Lipkin » Sun Aug 26, 2007 2:30 pm
Greg
Here is a snipit of code I use for turning rows different colors based on a fields condition per record ..
Rick Lipkin
SC Dept of Health, USA
//--------------------------------------
....
REDEFINE LISTBOX oBrow FIELDS ;
ALIAS xALIAS ;
ID 111 of oEMP ;
ON DBLCLICK ( _PtrpBrow( CTOD("00/00/00"), A->VNUMBER, A->LICENSE ),;
_ReFrsh( A->VNUMBER, dDATE1 ), ;
oBROW:REFRESH(), SysReFresh(),;
oBROW:SetFocus() ) ;
UPDATE
oBROW:nClrText := ;
{ || SelColor( A->MILEAGE, A->NEXTMILAGE,"F" ) }
oBROW:nClrPane := ;
{ || SelColor( A->MILEAGE, A->NEXTMILAGE,"B" ) }
oBROW:nClrForeFocus := ;
{ || SelColor( A->MILEAGE, A->NEXTMILAGE,"F" ) }
.....
//------------------------------
Static Func SelColor( nMILE,nMILE1,cTYPE )
LOCAL nCOLOR := CLR_BLACK
DO CASE
CASE cTYPE = 'F'
IF nMILE >= nMILE1 .and. nMILE1 <> 0
nCOLOR := CLR_WHITE
ELSE
nCOLOR := CLR_BLACK
ENDIF
CASE cTYPE = 'B'
DO CASE
CASE nMILE >= nMILE1 .and. nMILE1 <> 0
nCOLOR := RGB(192,3,51) // red
CASE ((nMILE1-nMILE) <= 500) .and. nMILE1 <> 0
nCOLOR := RGB(255,255,0) // yellow
OTHERWISE
nCOLOR := CLR_WHITE
ENDCASE
ENDCASE
RETURN( nCOLOR )