Hi,
To display lines in different colors in the xbrowse cell, I specify aCols [1]: aClrText: = {CLR _ BLACK, CLR_RED}.
Is it possible to make this setting not for all xBrose lines, but according to a certain condition ?
....
....
:bClrStd := {|| if(Len( aDeta ) > 0 , ;
{ CLR_BLACK,clrEstFondo(aDeta[oBrw:nArrayAt]["estado"]) } ,;
{ CLR_BLACK,clrEstFondo("S") } ) }
:bClrSelFocus := {|| if(Len( aDeta ) > 0 , ;
{ CLR_WHITE,clrEstSelec(aDeta[oBrw:nArrayAt]["estado"]) } ,;
{ CLR_WHITE,clrEstSelec("S") }) }
....
....
****************************
*CAMBIA EL COLOR DE LA CELDA
****************************
Function clrEstFondo(valor)
If valor=="S"
Return nRGB(255,255,255) //Blanco
ElseIf valor=="N"
Return nRGB(187,255,187) //Verde Claro
ElseIf valor=="M"
Return nRGB(187,187,255) //Azul Claro
ElseIf valor=="B"
Return nRGB(255,187,187) //Rojo Claro
Else
Return nRGB(255,255,255) //Blanco
Endif
*****************************************
*CAMBIA EL COLOR DE LA CELDA SELECCIONADO
*****************************************
Function clrEstSelec(valor)
If valor=="S"
Return RGB( 117, 186, 255 )
ElseIf valor=="N"
Return nRGB(0,210,0) //Verde Oscuro
ElseIf valor=="M"
Return nRGB(119,119,255) //Azul Oscuro
ElseIf valor=="B"
Return nRGB(255,117,117) //Rojo Oscuro
Else
Return RGB( 117, 186, 255 )
Endif
Natter wrote:Hi,
To display lines in different colors in the xbrowse cell, I specify aCols [1]: aClrText: = {CLR _ BLACK, CLR_RED}.
Is it possible to make this setting not for all xBrose lines, but according to a certain condition ?
#include "fivewin.ch"
function Main()
local oDlg, oBrw, oCol, oFont, oBold, oItalic, oImpact
local aClr1 := { CLR_HRED,CLR_GREEN,CLR_HBLUE }
local aClr2 := { CLR_HBLUE,CLR_HRED,CLR_GREEN }
local aData := { { "123", "ONE" + CRLF + "JANUARY" + CRLF + "MONDAY" }, ;
{ "234", "TWO" + CRLF + "FEBRUARY" + CRLF + "TUESDAY" }, ;
{ "345", "THREE" + CRLF + "MARCH" + CRLF + "WEDNESDAY" } }
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE FONT oImpact NAME "IMPACT" SIZE 0,-35
DEFINE FONT oBold NAME "VERDANA" SIZE 0,-18 BOLD
DEFINE FONT oItalic NAME "Times New Roman" SIZE 0,-16 BOLD ITALIC
DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL FONT oFont
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS CELL LINES NOBORDER
WITH OBJECT oBrw
:nDataStrAligns := AL_CENTER
:aCols[ 1 ]:oDataFont := oImpact
WITH OBJECT ( oCol := oBrw:aCols[ 2 ] )
:aDataFont := { oBold, oFont, oItalic }
:bClrStd := { || oCol:aClrText := If( oBrw:KeyNo % 2 == 0, aClr1, aClr2 ), ;
{ 0, CLR_WHITE } }
END
:nRowHeight := 100
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont, oBold, oItalic, oImpact
return nil
WITH OBJECT oBrw:aCols[ 2 ]
:aClrText := { |oCol,lHilite| If( lHilite, { CLR_WHITE, CLR_WHITE, CLR_WHITE }, ;
If( oCol:oBrw:KeyNo % 2 == 0, aClr1, aClr2 ) ) }
END
WITH OBJECT oBrw:aCols[ 2 ]
:bClrStd := { || If( oBrw:KeyNo % 2 == 0, { aClr1, CLR_WHITE }, { aClr2, CLR_WHITE } ) }
END
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 71 guests