In my VO programs I use bColorCondition in some bBrowsers.
One of those browsers show the contents of a dbf called parts (stock info) with a few virtual column showing the price retrieved from another dbf using the partnumber of the stock dbf, added like this for each column, where aList contains the keys for each pricelist:
oColumn := bVirtualFieldColumn{SELF:oDCBrowser,odbsServer,{|oServer,cList| oServer:GetPricelistValue(cList)},#Expression,aLists[ni]}
If I would base a color condition on the main sever (parts), this works fine (coloring alternate rows, this is from the bBrowser help showing an alternate coloring using the main server):
local cCond as string
cCond:="Server:RecNo%2=0"
oColorCondition := bColorCondition{cCond,oColumn:Server,Color{COLORRED}}
oColorCondition:SelectedForeground:=Color{COLORRED}
oColumn:ColorCondition:Add(oColorCondition)
But I can't use the server as I have to lookup a value using the server's partnumber and the current added column from another dbf. I thought that could be solved by using a codeblock which calls a method. It didn't work. Hence I created a simplified version to see where the problem was:
I changed the 1st+2nd line as follows:
local oCond as CodeBlock
oCond:={|oServer|oServer:SomeMethod}
oColorCondition := bColorCondition{oCond,oColumn:Server,Color{COLORRED}}
METHOD SomeMethod CLASS Parts
LOCAL lRet AS LOGIC
lRet:=SELF:RECNO%2=0 // SHould return true (and color red) for every second record of parts.dbf
Return lRet
Obviously I expect the same alternate coloring, this time done from SomeMethod. But what happens is that the cells (for the added virtual columns) show red for all visible lines, and when I browse further: none. Also the first lines turn black again when I browse back to the top.
Eventually the method should look up the partnumber in the pricelist dbf and return true or false depending on the return result. But if it already doesn't alternate the colors, I apparently should do something else. Can anyone point me in the right direction?
Dick