Changing cell color on xBrowse

Changing cell color on xBrowse

Postby HunterEC » 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.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Changing cell color on xBrowse

Postby Colin Haig » Tue Aug 09, 2011 11:30 pm

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

Hope this helps

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Changing cell color on xBrowse

Postby HunterEC » Wed Aug 10, 2011 3:21 am

Colin:

Thank you, I'll give it a try.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Changing cell color on xBrowse

Postby ukoenig » 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 :

Image

Code: Select all  Expand view

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 :lol:
Last edited by ukoenig on Tue Jul 30, 2013 6:21 am, edited 1 time in total.
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Changing cell color on xBrowse

Postby joseluisysturiz » Mon Jul 29, 2013 1:15 pm

Esta funcion me la dio y publico Daniel hace tiempisimo, aca la comparto, saludos... :shock:

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...

Image
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 25 guests

cron