and I want to color it if it doesn't contain any data
I made and I used Empty function
- Code: Select all Expand view
For n=1 to LEN(oBrw:aCols)
oCol := oBrw:aCols[ n ]
oCol:oBrush := {|| iif( Empty(oBrw:aArrayData[oBrw:KeyNo(),n] ), oBrush, nil ) }
Next n
but not run ok
I tried also with a codeblock
- Code: Select all Expand view
for each oCol in oBrw:aCols
oCol:oBrush := GenClrBlock( oCol,oBrush )
next
static function GenClrBlock( oCol,oBrush )
local oBrw := oCol:oBrw
local nCol := oCol:nCreationOrder
local xCol
return { || iif( Empty(oBrw:aArrayData[oBrw:KeyNo(),nCol] ), ;
oBrush, nil ) }
any solution ?
I made a minimal test to try
- Code: Select all Expand view
#include "fivewin.ch"
#include "xbrowse.ch"
function main()
local oDlg, oBrw
local aData := { { "One", "Two" }, { " ", "2" }, { "Five", "Six" } }
local oBrush
DEFINE BRUSH oBrush STYLE BDIAGONAL COLOR CLR_BLUE
DEFINE DIALOG oDlg SIZE 300,200 PIXEL TITLE "Test brush"
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS ;
CELL LINES NOBORDER
WITH OBJECT oBrw
For n=1 to LEN(oBrw:aCols)
oCol := oBrw:aCols[ n ]
oCol:oBrush := { ||iif( Empty(oBrw:aArrayData[oBrw:KeyNo(),n] ), oBrush, nil ) }
next
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil