I need some code to color a cell on screen and print, in an xbrowse when there is a value in the cell.
Thanks
oBrw:bClrStd := {|| iif( empty( oBrw:aCols[1]:Value() ) ), { CLR_WHITE, CLR_HGRAY }, { CLR_BLACK, getSysColor( 5 ) } ) }
oBrw:bClrSel := { || { CLR_BLACK, GetSysColor( COLOR_INACTIVECAPTION ) } }
oBrw:bClrSelFocus := { || { CLR_BLACK, GetSysColor( COLOR_HIGHLIGHT ) } }
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( DET->SDETAIL, CLR_YELLOW, CLR_WHITE) } }
NEXT
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( DET->SDETAIL, CLR_YELLOW, CLR_WHITE) } }
NEXT
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( nVara-nVarb, CLR_YELLOW, CLR_WHITE) } }
NEXT
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| If( nVara-nVarb, {CLR_BLUE, CLR_YELLOW}, {CLR_BLUE, CLR_WHITE } ) }
NEXT
hag wrote:I tried this:
- Code: Select all Expand view RUN
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( nVara-nVarb, CLR_YELLOW, CLR_WHITE) } }
NEXT
FOR I = 1 TO LEN(oBrw:aCols)
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( val(eval(oBrw:aCols[i]:bStrData))>500 , CLR_YELLOW, CLR_WHITE) } }
NEXT
oBrw:aCols[I]:bClrStd := {|| {CLR_BLUE, If( val(eval(oBrw:aCols[i]:bStrData))>500 , CLR_YELLOW, CLR_WHITE) } }
oCol:bClrStd := {|| {CLR_BLUE, If( val(eval(oCol:bStrData))>500 , CLR_YELLOW, CLR_WHITE) } }
oBrw:bClrStd := {|| {CLR_BLACK,CLR_WHITE, If( nVara-nVarb > 500, CLR_YELLOW, CLR_WHITE) } }
#include "FiveWin.ch"
#include "xbrowse.ch"
#define WID 350
#define HGT 200
REQUEST DBFCDX
function Main()
local oDlg, oBrw , oCol, nFor
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-18
USE CUSTOMER NEW SHARED VIA "DBFCDX"
SET ORDER TO TAG FIRST
GO TOP
DEFINE DIALOG oDlg SIZE 2*WID,2*HGT PIXEL FONT oFont
oBrw := TXBrowse():New( oDlg )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oCol := oBrw:AddCol()
oCol:AddResource( "CLIP" )
oCol:AddResource( "star" )
oCol:bLClickHeader = { | nMRow, nMCol, nFlags, Self | ;
If( ::nHeadBmpNo == 2, ::nHeadBmpNo := 1, ::nHeadBmpNo := 2 ), ::oBrw:Refresh() }
oCol:cHeader := "CLIP"
oCol:nHeadBmpNo := 1
oCol:nHeadBmpAlign := AL_RIGHT
oCol := oBrw:AddCol()
oCol:bStrData := { || _FIELD->First}
oCol:cHeader := "First"
oCol:oDataFont := oFont
oCol := oBrw:AddCol()
oCol:bStrData := { || _FIELD->Last}
oCol:cHeader := "Last"
// ----------- Field-color ----------
oCol:bClrStd := { || IIF( _FIELD->LAST = "Crystal", ;
{ 16777215,128 }, { 16777215, 6534803 } ) }
// -----------------------------------
oCol := oBrw:AddCol()
oCol:AddResource("GREEN")
oCol:AddResource("RED")
oCol:cHeader := "Married"
oCol:bBmpData := { || iif( _FIELD->Married, 1, 2) }
oCol:bStrData := { || iif( _FIELD->Married, "Yes", "No ")}
oCol:bEditValue := { || _FIELD->Married }
oCol:nDataStyle := oCol:DefStyle( AL_RIGHT, .T.)
oCol:nEditType := EDIT_LISTBOX
oCol:aEditListTxt := { "Yes", "No"}
oCol:aEditListBound := { .t., .f. }
oCol:bOnPostEdit := {|o, v| (DBRLOCK(), _FIELD->Married := v, DBUNLOCK() ) }
oBrw:SetRDD()
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )
CLOSE DATABASE
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Timm Sodtalbers and 46 guests