xbrowse row colours

xbrowse row colours

Postby Iris Gesser » Mon Mar 02, 2020 10:37 pm

Dear community,

I have tried to give a row another colour and it worked with this code.

oBrw:bClrStd := { || If( (cust->resstatus = "###Cancelled" .and. cust->guarancode = " "), { CLR_WHITE, CLR_RED }, { CLR_BLACK,CLR_WHITE } ) } //@IA 2020030

How can I integrate another colour for another request?
/* oBrw:bClrStd := { || If( ((cust->resstatus = "Waitlisted" .or. cust->resstatus = "Reserved" ).and. cust->guarancode = " "), ;
{ CLR_WHITE, CLR_GREEN }, { CLR_BLACK,CLR_WHITE } ) } //@IA 20200301*/

Do I have to use elseif in the oBrw:bClrStd?

If( (cust->resstatus = "###Cancelled" .and. cust->guarancode = " ") --> backgroundcolur should be red
If( ((cust->resstatus = "Waitlisted" .or. cust->resstatus = "Reserved" ).and. cust->guarancode = " ") --> backgroundcolur should be green

Thank you in advance and kind regards
Iris
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: xbrowse row colours

Postby cnavarro » Mon Mar 02, 2020 11:26 pm

Iris, if the condition to set the colors is very complicated, I advise you to use a function that returns the corresponding color array

Code: Select all  Expand view

oBrw:bClrStd := { || MyColors( oBrw ) }
.../...

Function MyColors( oBrw )
    local aColors := { , }

   If (cust->resstatus = "###Cancelled" .and. cust->guarancode = " ")
       aColors := { CLR_WHITE, CLR_RED }
   else
      if <other condition>
          aColors := { ....,  ..... }    etc.
      else
         aColors  := { CLR_BLACK,CLR_WHITE }
      endif
   endif
   .../...


Return aColors

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: xbrowse row colours

Postby Iris Gesser » Tue Mar 03, 2020 6:11 am

Thank you!
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: xbrowse row colours

Postby Iris Gesser » Tue Mar 03, 2020 8:55 pm

I have just tried it, It worked perfectly, thank you, Cristobal!
User avatar
Iris Gesser
 
Posts: 37
Joined: Fri Apr 22, 2016 10:19 pm

Re: xbrowse row colours

Postby cnavarro » Wed Mar 04, 2020 2:11 am

Dear Iris, another way is to define the codeblock like this:

Extended literal code block.
Syntax
<| [<params,...>] | <programcode> >

Code: Select all  Expand view

oBrw:bClrStd := <||
    local aColors := { , }

   If (cust->resstatus = "###Cancelled" .and. cust->guarancode = " ")
       aColors := { CLR_WHITE, CLR_RED }
   else
      if <other condition>
          aColors := { ....,  ..... }    etc.
      else
         aColors  := { CLR_BLACK,CLR_WHITE }
      endif
   endif
   .../...
Return aColors
>
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 83 guests

cron