fbpx
Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC: bBrowser ColorCondition not working

bBrowser ColorCondition not working 3 months 1 week ago #9714

  Jeff Rollo's Avatar Topic Author Jeff Rollo Offline Posts: 209
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.

Please Log in or Create an account to join the conversation.

Last edit: by Jeff Rollo.

bBrowser ColorCondition not working 3 months 1 week ago #9715

  Johan Nel's Avatar Johan Nel Offline Posts: 568
Hi Jeff,

BiggyRat wrote:

oColorCondition := bColorCondition{"oServer:JobFin = .t.", oServer, Color{COLORRED}}

Long time since I worked with bBrowser, but here is a conditional from a code snippet out some old code:
oBrowser:ColorCondition:Add(;
bColorCondition{'Server:ContractNo = 0 .AND. Server:AutoFormNo = 0', oServer, , Brush{Color{COLORRED}}})
oBrowser:ColorCondition:Add(bColorCondition{'Server:ContractNo > 0', oServer, , Brush{Color{COLORGREEN}}})
oBrowser:ColorCondition:Add(;
bColorCondition{'Server:ContractNo = 0 .AND. Server:AutoFormNo > 0', oServer, , Brush{Color{COLORBLUE}}})
I think the only problem you have is oServer instead of Server in your ColorCondtion codeblock string, and you need a Brush for the color, if I compare the code...
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

bBrowser ColorCondition not working 3 months 1 week ago #9716

  Jeff Rollo's Avatar Topic Author Jeff Rollo Offline Posts: 209
Thank you Johan, but that didn't work. Here's my revised code:

method PostInit(oWindow,iCtlID,oServer,uExtra) class TheGreenScreen
Local oColorCondition as bColorCondition
Local oColumn as bDataColumn

//Put your PostInit additions here
If IsNil(oServer)
oServer := DbServer{"Details"}
endif

oServer:SetOrder("JOBFINNO")
oServer:GoTop()

oColorCondition := bColorCondition{"Server:JobFin = .t.", oServer, , Brush{Color{COLORRED}}}
oColumn := self:oDCbBrowser1:GetColumn(#JOBFIN)
oDCbBrowser1:ColorCondition:Add(oColorCondition, {"Server:JobFin = .t.", oServer, , Brush{Color{COLORRED}}})
self:EnableSystemMenu(false)
self:oDCComboBox1:CurrentItemNo := 1
self:Caption := cAppVersion + " - Job Listing Screen"
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

Please Log in or Create an account to join the conversation.

bBrowser ColorCondition not working 3 months 1 week ago #9717

  Johan Nel's Avatar Johan Nel Offline Posts: 568
Jeff,

BiggyRat wrote: Thank you Johan, but that didn't work. Here's my revised code:
oDCbBrowser1:ColorCondition:Add(oColorCondition, {"Server:JobFin = .t.", oServer, , Brush{Color{COLORRED}}})

Change the above line to:
oDCbBrowser1:ColorCondition:Add(oColorCondition)
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

bBrowser ColorCondition not working 3 months 1 week ago #9718

  Johan Nel's Avatar Johan Nel Offline Posts: 568
Jeff,
Also I think you need to :Use() before you start painting the bBrowser, then move the color condition to the last statement after you have "painted" your bBrowser.
______________________
Johan Nel
George, South Africa

Please Log in or Create an account to join the conversation.

bBrowser ColorCondition not working 3 months 1 week ago #9719

  Karl-Heinz Rauscher's Avatar Karl-Heinz Rauscher Offline Posts: 372
Hi Jeff,

Following the other thread "JobinFNo" has the order condition "JobFin = .f." so you´ll *never* see a red row if your colorcondition is "Server:JobFin = .t."

What you need is a order without any order condition where the Index expression is "DTos(JobDate)". In this order all JobFin are included , no matter if the JobFin value is true or false. Otherwise you´re colorcondition doesn´t make any sence, because when you switch to the "JobinFYes " order *all* rows are red ;-).

Also, it´s a good idea to give the ColorCondition a readable Textcolor. something like:

oColorCondition := bColorCondition{"Server:JobFin = .t.", oServer, COlor { COLORWHITE }, Brush{Color{COLORRED}}}

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

Last edit: by Karl-Heinz Rauscher. Reason: changed "Hiredate" to "JobDate"

bBrowser ColorCondition not working 3 months 1 week ago #9720

  Jeff Rollo's Avatar Topic Author Jeff Rollo Offline Posts: 209

Jeff,
Also I think you need to :Use() before you start painting the bBrowser, then move the color condition to the last statement after you have "painted" your bBrowser.


Again, you've nailed it Johan, thank you very much once again.

Karl-Heinz, thank you also. I hear exactly what you're saying and in fact I use a combobox with 3 options - JobFinYes, JobFinNo and JobDate (all records, and is, as you suggest DTOS(JobDate)) using the 3 indexes (indices???)

Please Log in or Create an account to join the conversation.

bBrowser ColorCondition not working 3 months 1 week ago #9721

  Karl-Heinz Rauscher's Avatar Karl-Heinz Rauscher Offline Posts: 372

BiggyRat wrote: .
I hear exactly what you're saying and in fact I use a combobox with 3 options - JobFinYes, JobFinNo and JobDate (all records, and is, as you suggest DTOS(JobDate)) using the 3 indexes (indices???)



Hi Jeff,

I don´t know how your final color presentation should look like ? Which kind of coloring do you want excatly ? Do you want a coloring in each order , or only in the common "Jobdate" order ?

BTW. You can use more than one colorCondition. When you add this the rows are always colored - no matter which order is selected. But the result looks somehow strange :blink:

oColorCondition := bColorCondition{"Server:JobFin = .t.", oServer, Color { COLORWHITE }, Brush{Color{COLORRED}}}
oDCbBrowser1:ColorCondition:Add(oColorCondition)

oColorCondition := bColorCondition{"Server:JobFin = .f.", oServer, Color { COLORWHITE}, Brush{Color{COLORGREEN}}}
oDCbBrowser1:ColorCondition:Add(oColorCondition)

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

  • Page:
  • 1