FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Changing cell color on xBrowse
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Changing cell color on xBrowse
Posted: Tue Aug 09, 2011 10:31 PM

Guys:

How can I change a cell color, based on a condition, in xBrowse ? For example if an amount is less than zero, change the whole amount the red color to bright white over red (on text would be "W+/R") ?

Thank you.

Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: Changing cell color on xBrowse
Posted: Tue Aug 09, 2011 11:30 PM

oLbx:aCols[7]:bClrstd := {|| { CLR_BLACK, If( oPo:myob, CMYOBCOL, CBRWBACK) } }

Hope this helps

Colin

Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Re: Changing cell color on xBrowse
Posted: Wed Aug 10, 2011 03:21 AM

Colin:

Thank you, I'll give it a try.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Changing cell color on xBrowse
Posted: Mon Jul 29, 2013 10:19 AM
Changing a cell-color as the result of a incremental search.
( the full sample is included in a new UPDATE of the ASCVIEWER 3.2 )

The Table shows 3 sections with 25 rows ( from DBF ).
I've been looking for a solution to do a incremental search scanning
different sections of a xbrowse-table.
The cell with the found value I wanted to show with a different color :



Code (fw): Select all Collapse
FUNCTION SHOW_VKEYS(cKey)
LOCAL cKeySearch := "?  ", I := 1, nBRow := 1
LOCAL nKey := LEN(cKey)

DBSELECTAREA("VKEY")
DBGOTOP()

DO WHILE !EOF()
    IF cKey = SUBSTR( VKEY->KEY1, 1, nKey)  
        cKeySearch := VKEY->VALUE1
        nCPos := 1
        nBRow := VKEY->(ORDKEYNO())
        EXIT
    ELSEIF cKey = SUBSTR( VKEY->KEY2, 1, nKey)  
        cKeySearch := VKEY->VALUE2  
        nCPos := 3
        nBRow := VKEY->(ORDKEYNO())
        EXIT
    ELSEIF cKey = SUBSTR( VKEY->KEY3, 1, nKey)  
        cKeySearch := VKEY->VALUE3 
        nCPos := 5
        nBRow := VKEY->(ORDKEYNO())
        EXIT
    ENDIF

    DBSKIP(+1) 
ENDDO
oBrw2:aCols[nCPos]:bClrstd := {|| { nBTColor1, If( nBRow = oBrw2:KeyNo(), nBCSELECT, nBColor1 ) } }
oBrw2:aCols[nCPos + 1]:bClrstd := {|| { nBTColor2, If( nBRow = oBrw2:KeyNo(), nBCSELECT, nBColor2 ) } }

RETURN ( cKeySearch )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Changing cell color on xBrowse
Posted: Mon Jul 29, 2013 01:15 PM
Esta funcion me la dio y publico Daniel hace tiempisimo, aca la comparto, saludos... :-)

FUNCION cronograma()
.
.
.
.
FOR nFor = 6 to LEN( oBrw:aCols )
oBrw:aCols[ nFor ]:bClrStd := ChangeColor( oBrw, nFor )

NEXT
.
.
.
RETURN .T.

FUNCTION ChangeColor( oBrw, n ) //
*RETURN {|| { ColorCell( oBrw:aRow[ n ] ), ColorCell( oBrw:aRow[ n ] ) } } // TEXTO MISMO COLOR DE CELDA
RETURN {|| { ColorCell( oBrw:aCols[ n ]:Value ), ColorCell( oBrw:aCols[ n ]:Value ) } }

FUNCTION ColorCell( uDato ) // DEVUELVE COLOR SEGUN STATUS FORMA PAGO CUOTA

LOCAL nColor

DO CASE
CASE uDato == 1 // AMARILLO-PAGADAS AL DIA
nColor := RGB(255, 255, 128)

CASE uDato == 2 // AZUL-PAGADAS ADELANTADAS
nColor := RGB(0, 100, 200)

CASE uDato == 3 // MARRON CLARO-PAGADAS CON ATRASO
nColor := RGB(255, 172, 89)

CASE uDato == 9 // ROJO-CUOTAS VENCIDAS
nColor := RGB(240, 0, 0)

OTHERWISE
nColor := GetSysColor( 5 )

ENDCASE

RETURN nColor

...y para muestra un boton...

Dios no está muerto...



Gracias a mi Dios ante todo!

Continue the discussion