DCBROWSECOL COLOR lost on highlighted line with Xbase++ v2

This forum is for eXpress++ general support.
Message
Author
reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

DCBROWSECOL COLOR lost on highlighted line with Xbase++ v2

#1 Post by reganc »

We have a customer who extensively uses a dialog containing a browse displaying Invoice and Credit Notes.
The DCBROWSECOL...COLOR clause is used to set the foreground color of the items.
Invoices are set to GRA_CLR_BLACK.
Credit Notes are set to GRA_CLR_RED.
This coloring also shows correctly on the currently highlighted row.

And this worked fine when they were using an application built with Xbase++ 1.9.

They have now switched to an application built with Xbase++ 2.0 and the coloring is Ok on the non-highlighted lines but the highlighted line is only ever shown with a black foreground text color.

Can you tell me if this is this an Xbase++ issue or an Express++ one?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#2 Post by rdonnay »

Have you a small snippet of code that I can compile and run?
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#3 Post by reganc »

rdonnay wrote:Have you a small snippet of code that I can compile and run?
I'll get one together on Monday as I'm off until then (going to a Hot Air Balloon Festival for the weekend).

Thanks.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#4 Post by Wolfgang Ciriack »

Change all color arrays from a 2 value array to a 4 color array.
_______________________
Best Regards
Wolfgang

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#5 Post by reganc »

Wolfgang Ciriack wrote:Change all color arrays from a 2 value array to a 4 color array.
Thanks, Wolfgang. That worked perfectly.

Roger, does this mean that the code that handles a color array returned from a codeblack has a bug in it?
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#6 Post by rdonnay »

Roger, does this mean that the code that handles a color array returned from a codeblack has a bug in it?
I'm not sure what you did.

Show me the before and after code.
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#7 Post by reganc »

rdonnay wrote:
Roger, does this mean that the code that handles a color array returned from a codeblack has a bug in it?
I'm not sure what you did.

Show me the before and after code.
OK. Old code:

Code: Select all

STATIC FUNCTION LP_OrdColor(aLedger,aItem)

   LOCAL aColor, cAUTH

   aColor := {NIL,NIL}
   if ValType(aItem) = "A"
      if aItem[LP_ITEM_EL_TYPE] == "C" // credit note
         aColor:={GRA_CLR_RED,NIL}
         if aLedger[LP_EL_LEDGER] == "P" .and. !empty(aItem[LP_ITEM_EL_AUTH])
            if Get_Auth_From_Word(aItem[LP_ITEM_EL_AUTH])$"QN"
               aColor:={GraMakeRGBColor( { 225 , 140 , 140 } ),NIL}
            endif
         endif
      else
         if aLedger[LP_EL_LEDGER] == "P" .and. !empty(aItem[LP_ITEM_EL_AUTH])
            cAUTH:=Get_Auth_From_Word(aItem[LP_ITEM_EL_AUTH])
            if cAUTH == "Q" // query
               aColor:={GRA_CLR_DARKPINK,NIL}
            elseif cAUTH == "N" // held / not authorised
               aColor:={GRA_CLR_DARKGREEN,NIL}
            endif
         endif
      endif
   endif
RETURN aColor
New Code:

Code: Select all

STATIC FUNCTION LP_OrdColor(aLedger,aItem)

   LOCAL aColor, cAUTH

   aColor := {NIL,NIL,NIL,NIL}
   if ValType(aItem) = "A"
      if aItem[LP_ITEM_EL_TYPE] == "C" // credit note
         aColor:={GRA_CLR_RED,NIL,GRA_CLR_RED,NIL}
         if aLedger[LP_EL_LEDGER] == "P" .and. !empty(aItem[LP_ITEM_EL_AUTH])
            if Get_Auth_From_Word(aItem[LP_ITEM_EL_AUTH])$"QN"
               aColor:={GraMakeRGBColor( { 225 , 140 , 140 } ),NIL,GraMakeRGBColor( { 225 , 140 , 140 } ),NIL}
            endif
         endif
      else
         if aLedger[LP_EL_LEDGER] == "P" .and. !empty(aItem[LP_ITEM_EL_AUTH])
            cAUTH:=Get_Auth_From_Word(aItem[LP_ITEM_EL_AUTH])
            if cAUTH == "Q" // query
               aColor:={GRA_CLR_DARKPINK,NIL,GRA_CLR_DARKPINK,NIL}
            elseif cAUTH == "N" // held / not authorised
               aColor:={GRA_CLR_DARKGREEN,NIL,GRA_CLR_DARKGREEN,NIL}
            endif
         endif
      endif
   endif
RETURN aColor
I didn't really have a clue what values to put into the 4 element array so I had to assume the 1st two elements were a FG and BG pair and the last two were too.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Wolfgang Ciriack
Posts: 479
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#8 Post by Wolfgang Ciriack »

I didn't really have a clue what values to put into the 4 element array so I had to assume the 1st two elements were a FG and BG pair and the last two were too.
I use this for changing some colors when the cursor is on this line, for example
{GRA_CLR_WHITE,GRA_CLR_DARKGREEN,GRA_CLR_DARKGREEN,nil}
Attachments
Image.png
Image.png (9.68 KiB) Viewed 14790 times
_______________________
Best Regards
Wolfgang

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#9 Post by reganc »

Wolfgang Ciriack wrote:
I didn't really have a clue what values to put into the 4 element array so I had to assume the 1st two elements were a FG and BG pair and the last two were too.
I use this for changing some colors when the cursor is on this line, for example
{GRA_CLR_WHITE,GRA_CLR_DARKGREEN,GRA_CLR_DARKGREEN,nil}
Out of interest, how did you find out about the 4 elements needed? I cannot find any mention of it in the documentation.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: DCBROWSECOL COLOR lost on highlighted line with Xbase++

#10 Post by Cliff Wiernik »

I found out about the NIL process from Roger. That appears to cause the normal color to occur.

Post Reply