bBrowser ColorCondition not working
Posted: Sun Jul 07, 2019 6:55 am
Sorry again, but what am I doing wrong here please? I've looked in the bBrowser help file, and the example .AEF file, but I still can't get it to work.
This is the postinit code I'm currently attempting:
method PostInit(oWindow,iCtlID,oServer,uExtra) class TheGreenScreen
Local oColorCondition as bColorCondition
Local oColumn as bDataColumn
//Put your PostInit additions here
oServer := DETAILS{}
oServer:SetOrder("JOBFINNO")
oServer:GoTop()
oColorCondition := bColorCondition{"oServer:JobFin = .t.", oServer, Color{COLORRED}}
oColumn := self:oDCbBrowser1:GetColumn(#JOBFIN)
oColumn:ColorCondition:Add(oColorCondition)
self:oDCComboBox1:CurrentItemNo := 1
self:oDCbBrowser1:Use(oServer,{#JobDate, #JOBNUMBER, #CLCODE, #CLNAME, #JOBTIME, #JOBDETAILS, #PONUMBER, #RATE, #UNITS, #RATETYPE, #NPC, #JOBFIN, #REGO, #SUBBY, #INVOICED, #INVFILE, #MAPFILE })
self:oDCbBrowser1:GetColumn(#JobDate):Width := 90
self:oDCbBrowser1:GetColumn(#JOBNUMBER):Width := 95
self:oDCbBrowser1:GetColumn(#CLCODE):Width := 90
self:oDCbBrowser1:GetColumn(#CLNAME):Width := 400
self:oDCbBrowser1:GetColumn(#JOBTIME):Width := 80
self:oDCbBrowser1:GetColumn(#JOBDETAILS):Width := 450
self:oDCbBrowser1:GetColumn(#RATE):Width := 90
self:oDCbBrowser1:GetColumn(#UNITS):Width := 90
self:oDCbBrowser1:GetColumn(#RATETYPE):Width := 100
self:oDCbBrowser1:GetColumn(#PONUMBER):Width := 160
self:oDCbBrowser1:GetColumn(#NPC):Width := 500
self:oDCbBrowser1:GetColumn(#JOBFIN):Width := 100
self:oDCbBrowser1:GetColumn(#REGO):Width := 500
self:oDCbBrowser1:GetColumn(#SUBBY):Width := 500
self:oDCbBrowser1:GetColumn(#INVOICED):Width := 100
self:oDCbBrowser1:GetColumn(#INVFILE):Width := 500
self:oDCbBrowser1:GetColumn(#MAPFILE):Width := 500
self:oDCbBrowser1:Refresh()
self:oDCbBrowser1:Recalculate()
self:oDCbBrowser1:SetFocus()
uExtra := self:oDCbBrowser1:Server:FIELDGET(#JOBNUMBER)
return uExtra
The aim of this exercise is to highlight EITHER the entire row, or just the JOBFIN cell based on if JOBFIN (logic field) is TRUE. If True highlight in RED in this example, if not, and JOBFIN is FALSE, leave it alone.
This is the postinit code I'm currently attempting:
method PostInit(oWindow,iCtlID,oServer,uExtra) class TheGreenScreen
Local oColorCondition as bColorCondition
Local oColumn as bDataColumn
//Put your PostInit additions here
oServer := DETAILS{}
oServer:SetOrder("JOBFINNO")
oServer:GoTop()
oColorCondition := bColorCondition{"oServer:JobFin = .t.", oServer, Color{COLORRED}}
oColumn := self:oDCbBrowser1:GetColumn(#JOBFIN)
oColumn:ColorCondition:Add(oColorCondition)
self:oDCComboBox1:CurrentItemNo := 1
self:oDCbBrowser1:Use(oServer,{#JobDate, #JOBNUMBER, #CLCODE, #CLNAME, #JOBTIME, #JOBDETAILS, #PONUMBER, #RATE, #UNITS, #RATETYPE, #NPC, #JOBFIN, #REGO, #SUBBY, #INVOICED, #INVFILE, #MAPFILE })
self:oDCbBrowser1:GetColumn(#JobDate):Width := 90
self:oDCbBrowser1:GetColumn(#JOBNUMBER):Width := 95
self:oDCbBrowser1:GetColumn(#CLCODE):Width := 90
self:oDCbBrowser1:GetColumn(#CLNAME):Width := 400
self:oDCbBrowser1:GetColumn(#JOBTIME):Width := 80
self:oDCbBrowser1:GetColumn(#JOBDETAILS):Width := 450
self:oDCbBrowser1:GetColumn(#RATE):Width := 90
self:oDCbBrowser1:GetColumn(#UNITS):Width := 90
self:oDCbBrowser1:GetColumn(#RATETYPE):Width := 100
self:oDCbBrowser1:GetColumn(#PONUMBER):Width := 160
self:oDCbBrowser1:GetColumn(#NPC):Width := 500
self:oDCbBrowser1:GetColumn(#JOBFIN):Width := 100
self:oDCbBrowser1:GetColumn(#REGO):Width := 500
self:oDCbBrowser1:GetColumn(#SUBBY):Width := 500
self:oDCbBrowser1:GetColumn(#INVOICED):Width := 100
self:oDCbBrowser1:GetColumn(#INVFILE):Width := 500
self:oDCbBrowser1:GetColumn(#MAPFILE):Width := 500
self:oDCbBrowser1:Refresh()
self:oDCbBrowser1:Recalculate()
self:oDCbBrowser1:SetFocus()
uExtra := self:oDCbBrowser1:Server:FIELDGET(#JOBNUMBER)
return uExtra
The aim of this exercise is to highlight EITHER the entire row, or just the JOBFIN cell based on if JOBFIN (logic field) is TRUE. If True highlight in RED in this example, if not, and JOBFIN is FALSE, leave it alone.