I did something similar to this in an old app of mine using the Standard FWH Listbox class and it was based on the column.
For some reason this logic failed for me after version 9.10 and I changed this over to xBrowse .. If there is anything relevant here you can use .. let me know.
DEFINE WINDOW oWnd1 ;
FROM 1,1 to 30,110 ;
TITLE cTITLE ;
MENU ProjMenu(oRsProj, oWndMdi) ;
ICON oICO ;
NOMINIMIZE ;
NOZOOM ;
MDICHILD
@ 0, 0 LISTBOX oBrw FIELDS ;
oRsProj:Fields("PROJNAME"):Value, ;
substr(oRsProj:Fields("descrip"):Value,1,25),;
oRsProj:Fields("reporting"):Value,;
oRsProj:Fields("projmgr"):Value, ;
IF(EMPTY(oRsProj:Fields("start_date"):Value), dtoc(ctod("")), oRsProj:Fields("start_date"):Value),;
IF(EMPTY(oRsProj:Fields("end_date"):Value), dtoc(ctod("")), oRsProj:Fields("end_date"):Value),;
transform(oRsProj:Fields("est_budget"):Value,"999,999,999.99"),;
oRsProj:Fields("frequency"):Value, ;
IF(EMPTY(oRsProj:Fields("row_color"):Value),"NO STATUS", oRsProj:Fields("row_color"):Value);
SIZES 130,183,30,85,85,85,85,90,90 ;
HEADERS "Proj Name", ;
"Description", ;
"CRpt", ;
"ProjMgr", ;
"Orig Start Dt", ;
"Orig End Date", ;
"Orig Est Budget", ;
"Frequency", ;
"Last Status" ;
ON DBLCLICK( _ProjView( "V", oRsProj,"","" ) ) ;
UPDATE
oBrw:bLogicLen := { || oRsProj:RecordCount }
oBrw:bGoTop := { || oRsProj:MoveFirst() }
oBrw:bGoBottom := { || oRsProj:MoveLast() }
oBrw:bSkip := { | nSkip | Skipper( oRsProj, nSkip ) }
oBrw:cAlias := "ARRAY"
// paint the row colors active and status column //
obrw:nClrText := { |nCOL| SelColorF( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "F" ) }
oBrw:nClrPane := { |nCOL| SelColorB( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "B" ) }
// oBrw:nClrForeFocus = { |nCOL| SelColorH( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "F" ) }
oBrw:nClrBackFocus := { |nCOL| SelColorH( nCOL, oRsProj:Fields("row_color"):Value, oRsProj:Fields("active"):Value, "B" ) }
oWND1:oClient := oBRW
oWND1:SetControl( oBrw )
ACTIVATE WINDOW oWND1 ;
ON INIT( IF( lFROMLINK = .T., (_ProjView( "V", oRsProj,"", lFROMLINK )), ));
VALID ( IIF( !lOK, _ProjClose(.T.), .F. ))
RETURN( .T. )
//-------------------------------
STATIC FUNCTION SKIPPER( oRsx, nSkip )
LOCAL nRec := oRsx:AbsolutePosition
oRsx:Move( nSkip )
IF oRsx:EOF; oRsx:MoveLast(); ENDIF
IF oRsx:BOF; oRsx:MoveFirst(); ENDIF
RETURN( oRsx:AbsolutePosition - nRec )
//-----------------------------------------------
Static Func SelColorB( nCOL, cCOLOR, cACTIVE, cTYPE )
LOCAL nCOLOR := CLR_WHITE
// background for all cells
DO CASE
CASE nCOL < 9
IF cACTIVE = 'Y'
nCOLOR := CLR_WHITE
ELSE
nCOLOR := RGB(179,203,204) // light blue
ENDIF
CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "B"
nCOLOR := CLR_HGREEN
CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "B"
nCOLOR := CLR_YELLOW
CASE nCOL = 9 .and. cCOLOR = "RED" .and. cTYPE = "B"
nCOLOR := CLR_HRED
ENDCASE
RETURN( nCOLOR )
//--------------------
Static Func SelColorF( nCOL, cCOLOR, cACTIVE, cTYPE )
LOCAL nCOLOR := CLR_BLACK
// forground for all cells
IF EMPTY(nCOL) .or. nCOL = NIL
nCOL := 8
ENDIF
DO CASE
CASE nCOL < 9
IF cACTIVE = 'Y'
nCOLOR := CLR_BLACK
ELSE
nCOLOR := CLR_BLACK // RGB(255,0,0 ) // red
ENDIF
CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "F"
nCOLOR := CLR_BLACK
CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "F"
nCOLOR := CLR_BLACK
CASE nCOL = 9 .and. cCOLOR = "RED" .and. cTYPE = "F"
nCOLOR := CLR_BLACK
ENDCASE
RETURN( nCOLOR )
//-----------------------------------------------
Static Func SelColorH( nCOL, cCOLOR, cACTIVE, cTYPE )
// background for hi-lite bar
LOCAL nCOLOR := CLR_HGRAY
DO CASE
CASE nCOL < 9
IF cACTIVE = 'Y'
nCOLOR := rgb( 122,122,122 ) //CLR_HGRAY
ELSE
nCOLOR := RGB(179,203,204) // light blue
ENDIF
CASE nCOL = 9 .and. cCOLOR = "GREEN" .and. cTYPE = "B"
nCOLOR := CLR_HGREEN
CASE nCOL = 9 .and. cCOLOR = "YELLOW".and. cTYPE = "B"
nCOLOR := CLR_YELLOW
CASE nCOL = 9 .and. cCOLOR = "RED" .and. cTYPE = "B"
nCOLOR := CLR_HRED
ENDCASE
RETURN( nCOLOR )