AEval(oBrw:aCols,{ |oCol| oCol:bClrStd:=CellClr(oCol) } )
//----------------------------------------//
Function CellClr(oCol)
Return {|| { iif(oCol:Value = <Your Condition>,CLR_YELLOW,CLR_BLACK) } }
aRowGrad := { { .5, RGB( 0,251,220), RGB( 0,251,220) }, ;
{ .5, RGB(221,255,251), RGB(221,255,25) } }
WITH OBJECT oBrw
:bClrSelFocus := { || { CLR_BLACK, aSelGrad } }
/////:bClrRowFocus := { || { CLR_BLACK, aRowGrad } }
END
#include "FiveWin.ch"
#include "xbrowse.ch"
function main()
local oDlg, oBrw
local aArray := {}
local nI
for nI = 1 to 20
aadd( aArray, { StrZero(nI,2), 0, 0, 0, 0, 0 } )
next
DEFINE DIALOG oDlg Title "Test xBrowse - Color Cell" size 300,300
oBrw:= txbrowse():new( oDlg )
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:SetArray( aArray )
oBrw:lFastEdit = .T.
oBrw:CreateFromCode()
for nI = 2 to Len( oBrw:aCols )
oBrw:aCols[ nI ]:bClrStd := ChangeColor( oBrw, nI )
oBrw:aCols[ nI ]:nEditType = 1
next
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg center on init oDlg:Resize()
return nil
function ChangeColor( oBrw, n )
return {|| { CLR_BLACK, ColorCell( oBrw:aRow[ n ] ) } }
function ColorCell( uDato )
local nColor
DO CASE
CASE uDato == 1
nColor := CLR_GREEN
CASE uDato == 2
nColor := CLR_YELLOW
CASE uDato == 3
nColor := CLR_HRED
CASE uDato == 4
nColor := CLR_CYAN
OTHERWISE
nColor := GetSysColor( 5 )
ENDCASE
return nColor
lo que busco es poner 2 colores para diferenciar los 2 datos de cada celda.
function ChangeColor( oBrw, n )
return {|| { CLR_BLACK, ColorCell( oBrw:aRow[ n ] ) } }
function ChangeColor( oBrw, n )
return {|| { ColorCell( oBrw:aRow[ n ] ), GetSysColor( 5 ) } }
#include "FiveWin.ch"
#include "xbrowse.ch"
function main()
local oDlg, oBrw
local aArray := {}
local nI
local aFont := Array( 4 )
local oBrush
for nI = 1 to 20
aadd( aArray, { StrZero(nI,2), 0, 0, 0, 0, 0 } )
next
DEFINE FONT aFont[ 1 ] NAME "Arial" SIZE 8, 10
DEFINE FONT aFont[ 2 ] NAME "Times New Roman" SIZE 10, 16
DEFINE FONT aFont[ 3 ] NAME "Arial" SIZE 12, 10 ITALIC
DEFINE FONT aFont[ 4 ] NAME "Courier New" SIZE 14, 10 BOLD
DEFINE DIALOG oDlg Title "Test xBrowse - Color Cell" size 300,300
oBrw:= txbrowse():new( oDlg )
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:SetArray( aArray )
oBrw:lFastEdit = .T.
oBrw:CreateFromCode()
for nI = 2 to Len( oBrw:aCols )
oBrw:aCols[ nI ]:bClrStd := ChangeColor( oBrw, nI )
oBrw:aCols[ nI ]:oDataFont := ChangeFont( oBrw, nI, aFont )
oBrw:aCols[ nI ]:nEditType = 1
next
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg center on init oDlg:Resize()
AEval( aFont, {| o | o:End() } )
return nil
function ChangeColor( oBrw, n )
return {|| { ColorCell( oBrw:aRow[ n ] ), GetSysColor( 5 ) } }
function ChangeFont( oBrw, n, aFont )
return {|| aFont[ FontCell( oBrw:aRow[ n ] ) ] }
function ColorCell( uDato )
local nColor
DO CASE
CASE uDato == 1
nColor := CLR_GREEN
CASE uDato == 2
nColor := CLR_YELLOW
CASE uDato == 3
nColor := CLR_RED
CASE uDato == 4
nColor := CLR_CYAN
ENDCASE
return nColor
function FontCell( uDato )
local nFont := 1
DO CASE
CASE uDato == 1
nFont := 4
CASE uDato == 2
nFont := 3
CASE uDato == 3
nFont := 2
CASE uDato == 4
nFont := 1
ENDCASE
return nFont
#include 'fivewin.ch'
#include 'colors.ch'
#include 'xbrowse.ch'
*--------------
FUNCTION Main()
*--------------
LOCAL oDlg, oBrw
LOCAL oFont, oBold, oRed
LOCAL aData := {}
DEFINE FONT oRed NAME 'ARIAL' SIZE 0,-18 ITALIC
DEFINE FONT oBold NAME 'TAHOMA' SIZE 0,-12 BOLD
AAdd( aData, { 1, 'Otto ', ;
'Mr.Otto' + CRLF + ;
'deleveloped using multiple fonts in the same cell' } )
AAdd( aData, { 2, 'Antonio', ;
'FWH' + CRLF + ;
'Provides easier solution for owner drawing data without changing library code' } )
AAdd( aData, { 3, 'Carles', ;
"MR.OTTO'S" + CRLF + ;
'work is well appreciated' } )
AAdd( aData, { 4, 'Richard', ;
"MR.OTTO'S" + CRLF + ;
'work is well appreciated' } )
DEFINE DIALOG oDlg SIZE 540,440 PIXEL FONT oFont TITLE 'Test ::bPaintText'
@ 20, 10 XBROWSE oBrw ;
HEADERS 'No', 'Name', 'Text' ;
SIZE 250, 200 PIXEL ;
OF oDlg ;
ARRAY aData AUTOCOLS ;
LINES
WITH OBJECT oBrw:aCols[3]
:nHeadStrAlign := AL_CENTER
:nWidth := 200
:bPaintText := { |oCol, hDC, cText, aCoord| DrawCol( oCol, hDC, cText, aCoord, oBold, oRed ) }
END
oBrw:nStretchCol := STRETCHCOL_LAST
oBrw:nDataLines := 3
oBrw:nMarqueeStyle := 5
oBrw:nRowDividerStyle := 0
oBrw:nColDividerStyle := 0
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oBold
RELEASE FONT oRed
RETU NIL
*---------------------------------------------------------------
STATIC FUNCTION DrawCol( oCol, hDC, cText, aCoord, oBold, oRed )
*---------------------------------------------------------------
local nTop := aCoord[ 1 ], nLeft := aCoord[ 2 ]
local nBottom := aCoord[ 3 ], nRight := aCoord[ 4 ]
local nWidth := nRight - nLeft
local nHeight := nBottom - nTop
local nRow := nTop
local cLine, nFontHt, nAt
nAt := AT( CRLF, cText )
IF nAt > 0
cLine := Left( cText, nAt - 1 )
oRed:Activate( hDC )
SetTextColor( hDC, CLR_HRED )
nFontHt := GetTextHeight( oCol:oBrw:hWnd, hDC )
DrawTextEx( hDC, cLine, { nRow, nLeft, nBottom, nRight }, oCol:nDataStyle )
oRed:DeActivate( hDC )
nRow += nFontHt + 4
cLine := SubStr( cText, nAt + 2 )
oBold:Activate( hDC )
SetTextColor( hDC, CLR_BLACK )
DrawTextEx( hDC, cLine, { nRow, nLeft, nBottom, nRight }, oCol:nDataStyle )
oBold:DeActivate( hDC )
ENDIF
RETU NIL
#include "Fivewin.ch"
#include "Folder.ch"
#include "Xbrowse.ch"
#include "Xml.ch"
#include "hbxml.ch"
#include "ribbon.ch"
#include "image.ch"
#include "FastReph.ch"
#include "codebar.ch"
FUNCTION prg_202()
LOCAL oDlg,oDbf1,oLbx
LOCAL acAnexo2:={}
PRIVATE r_orden:=1,r_clifac:='',r_docfac:=''
CGreen:={ { 0.50,65280,16777215 },{ 0.50,16777215,65280 } }
CYellow:= { { 0.50,65535,16777215 },{ 0.50,16777215,65535 }}
CRed:= { { 0.50,255,16777215 },{ 0.50,16777215,255 }}
COrange:= { { 0.50,33023,16777215 },{0.50,16777215,33023 }}
IF NetUse("NOTAVNTA", .T. )
DATABASE oDbf1
oDbf1:Load()
ELSE
MsgStop( "Fichero NOTA DE VENTAS Bloqueado" )
RETURN NIL
ENDIF
dbSelectArea(oDbf1:cAlias)
set order to 2
go top
do while .not. eof().and.val((odbf1:calias)->restado)<4
aadd(acAnexo2,{ (odbf1:calias)->rfolio,dtoc((oDbf1:cAlias)->rfecha),;
(oDbf1:cAlias)->rtipod,(oDbf1:cAlias)->rnombre,;
(oDbf1:cAlias)->rtotalnv1,(odbf1:calias)->rorden,;
(odbf1:calias)->rselect,(odbf1:calias)->ratencion,;
(odbf1:calias)->rprovisor} )
skip
enddo
if empty(acAnexo2)
aadd(acAnexo2,{"","","","",0,0,"","",""})
endif
DEFINE DIALOG oDlg RESOURCE "SVE202"
REDEFINE XBROWSE oLbx ID 101 OF Odlg;
COLUMNS 1,2,3,4,5,6,7,8,9;
HEADERS "Folio","Fecha","T/D","Nombre Factura","Valor Total",;
"Orden","Estado","Nro.Atencion","Nro.Provisorio";
COLSIZES 70,65,30,200,70,55,90,90,75;
PICTURE ,,,,'999,999,999.99';
ARRAY acAnexo2 AUTOSORT UPDATE FOOTERS LINES AUTOCOLS CELL;
ON RIGHT CLICK (prgres2(olbx:aArraydata[olbx:narrayat][7],;
val(olbx:aArraydata[olbx:narrayat][1])))
olbx:bClrStd := {|| {CLR_BLACK, IF( olbx:aArrayData[olbx:nArrayAt][7]='SELECCIONADO',cYellow,;
IF( olbx:aArrayData[olbx:nArrayAt][7]='PENDIENTE',cOrange,;
IF( olbx:aArrayData[olbx:nArrayAt][7]='VISADO',cGreen,;
IF( olbx:aArrayData[olbx:nArrayAt][7]='ERROR XML',cRed,;
IF( olbx:aArrayData[olbx:nArrayAt][7]='RECHAZADO',cRed,CLR_WHITE ))))) } }
ACTIVATE DIALOG oDlg CENTERED ON INIT (olbx:maketotals(),olbx:gotop(),olbx:refresh())
NETCLOSEALL()
RETURN .T.
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 46 guests