Tengo el siguiente codigo, que si omito el BACKGROUND del XBrowse funciona OK, de lo contrario no colorea fondo de las Celdas:
- Code: Select all Expand view
- #include "fivewin.ch"
#include "xbrowse.ch"
STATIC aMe, aRu
//--------------------------------------------//
FUNCTION Main() //ColorDeCeldas()
local n, oDlg, oBrw1, oBrw2
CreaLosArrays()
DEFINE DIALOG oDlg SIZE 540,200 PIXEL TITLE "COLORES DE CELDAS"
@ 10, 10 XBROWSE oBrw1 SIZE 120,-10 PIXEL OF oDlg DATASOURCE aRu ;
COLUMNS 2,3 HEADERS "Numero", "Color"
oBrw1:nRowHeight := 24
oBrw1:CreateFromCode()
@ 10, 140 XBROWSE oBrw2 SIZE 120,-10 PIXEL OF oDlg DATASOURCE aMe ;
COLUMNS 1,2,3 HEADERS "Col1","Col2","Col3" ;
CELL LINES NOBORDER //BACKGROUND "c:\fwh1709\bitmaps\olga1.jpg" FILL
oBrw2:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw2:nRowHeight := 30
for n := 1 to Len( oBrw2:aCols )
oBrw2:aCols[ n ]:bClrStd := ColorCelda( oBrw2, n )
next
oBrw2:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
Return nil
//-----------------------------------------------------//
function ColorCelda( oBrw, n )
return {|| SeleccClr( oBrw:aRow[ n ] ) }
//-----------------------------------------------------//
function SeleccClr( uDato )
local n, cClr:="", nClrBkg, nClrTxt := RGB(255,255,255) //Blanco
for n := 1 to len(aRu)
if aRu[n,2] == uDato
cClr := aRu[n,3]
exit
endif
Next
if cClr == "VERDE"
nClrBkg := RGB(0, 215, 0)
elseif cClr == "ROJO"
nClrBkg := RGB(225, 0, 0)
elseif cClr == "NEGRO"
nClrBkg := RGB(0, 0, 0)
else
nClrBkg := GetSysColor( 5 )
endif
return { nClrTxt, nClrBkg }
//-----------------------------
Function CreaLosArrays()
local n, aNms, aClr
aNms := {'1', '2', '3', '4', '5','10','11'}
aClr := {'V', 'N', 'R', 'V', 'R', 'V', 'R'}
aRu := {}
For n := 1 to Len(aNms)
aadd( aRu, {,,} )
aRu[n,1] := n
aRu[n,2] := if(len(aNms[n])=1, aNms[n]+" ", aNms[n])
aRu[n,3] := if(upper(aClr[n]) ="V","VERDE" ,;
if(upper(aClr[n]) ="R","ROJO" ,;
if(upper(aClr[n]) ="N","NEGRO",)))
Next
aMe := Array(3)
aMe[1] := {'1 ', '2 ', ' '}
aMe[2] := {'3 ', '4 ', '5 '}
aMe[3] := {'5 ', '10', '11'}
Return nil
Es posible colorear fondo de las celdas usando el BACKGROUND ?
Agradezco cualquier código de muestra.