XBROWSE COLOR ROWS

XBROWSE COLOR ROWS

Postby Otto » Fri Sep 18, 2020 7:34 am

Dear Mr. Rao,
Can you please help me.
I try to change row colors.
With a button I do:
oBrw:bClrStd := {||{CLR_WHITE,rgb(240, 173, 78) }}

But if I look into the paint method of xBrowse, there are no changes:
METHOD Display() CLASS TXBrowse

local nSecs := SECONDS()

if !::lCreated
return nil
endif

fwlog Eval( ::bClrSel )
...

Can you please show me how I can change bClrStd.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6344
Joined: Fri Oct 07, 2005 7:07 pm

Re: XBROWSE COLOR ROWS

Postby cnavarro » Fri Sep 18, 2020 10:41 am

Dear Otto
This run OK for me ( in ACTION Button )
Code: Select all  Expand view  RUN

oBrw1:bClrStd := { || { CLR_WHITE, CLR_BLACK } }
 oBrw1:Refresh()
 
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: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBROWSE COLOR ROWS

Postby Otto » Fri Sep 18, 2020 12:08 pm

WIKI

Postby Otto » Fri Sep 18, 2020 12:01 pm
Dear Cristobal,
I inserted the code into yunus.prg.

static function Invoices() and commented

// BrwColors( oBrw ).

This is not working.

If BrwColors( oBrw ) is uncommented, then I get black background but not the rows.

Maybe it is different when there is mdi?

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6344
Joined: Fri Oct 07, 2005 7:07 pm

Re: XBROWSE COLOR ROWS

Postby nageswaragunupudi » Fri Sep 18, 2020 1:48 pm

Mr. Otto

Please try
Code: Select all  Expand view  RUN
oBrw:bClrStds := {||{CLR_WHITE,rgb(240, 173, 78) }}
 

Note: bClrStds not bClrStd
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE COLOR ROWS

Postby ukoenig » Fri Sep 18, 2020 2:46 pm

Thank You Mr. Rao,

I added for a test 2 buttons to YUNUS.prg
( switching row-colors on button-action )

Image

Code: Select all  Expand view  RUN

static function Clients()
..
..
// I added 2 buttons

      DEFINE BUTTON OF oBar PROMPT "Color" RESOURCE "magic" ;
         ACTION BrwColors1( oBrw, 1 )
     
     DEFINE BUTTON OF oBar PROMPT "Reset" RESOURCE "prev" ;
         ACTION BrwColors1( oBrw, 2 )

// ---------------

static function BrwColors1( oBrw, nStatus )

IF nStatus = 1
     oBrw:bClrStds = { || If( oBrw:KeyNo() % 2 == 0, ;
     { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
       RGB( 240, 173, 78 ) }, ;
     { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
       nRGB( 255, 217, 197 ) } ) }
ELSE
     oBrw:bClrStds = { || If( oBrw:KeyNo() % 2 == 0, ;
     { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
       RGB( 198, 255, 198 ) }, ;
     { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
       RGB( 232, 255, 232 ) } ) }
ENDIF
oBrw:Refresh()

return nil

 


working with conditions and multiple colors

Image

Code: Select all  Expand view  RUN

static function BrwColors1( oBrw, nStatus )

IF nStatus = 1
     oBrw:bClrStds = { || If( oBrw:KeyNo() > 6 .and. oBrw:KeyNo() < 12 ;
       .or. oBrw:KeyNo() > 14 .and. oBrw:KeyNo() < 18 , ;  // any condition
       { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
         If( oBrw:KeyNo() > 6 .and. oBrw:KeyNo() < 12, nRGB( 240, 173, 78 ), nRGB( 140, 168, 197 ) ) }, ;
         { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
           If( oBrw:KeyNo() % 2 == 0, nRGB( 198, 255, 198 ), nRGB( 232, 255, 232 ) ) } ) }
ELSE
     oBrw:bClrStds = { || If( oBrw:KeyNo() % 2 == 0, ;
          { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
                 nRGB( 198, 255, 198 ) }, ;
          { If( ( oBrw:cAlias )->( Deleted() ), CLR_HRED, CLR_BLACK ),;
                 nRGB( 232, 255, 232 ) } ) }
ENDIF
oBrw:Refresh()

return nil
 


regards
Uwe :D
Last edited by ukoenig on Fri Sep 18, 2020 8:37 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: XBROWSE COLOR ROWS

Postby Otto » Fri Sep 18, 2020 7:02 pm

Dear Mr Rao, Critobal and Uwe,
many thanks for your help. It works.

Mr. Rao can you please explain to me
the differences of bClrStds and bClrStd.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6344
Joined: Fri Oct 07, 2005 7:07 pm

Re: XBROWSE COLOR ROWS

Postby nageswaragunupudi » Sat Sep 19, 2020 6:12 am

Code: Select all  Expand view  RUN

oBrw:bClrStds := b
 

is equivalent to
Code: Select all  Expand view  RUN

for n := 1 to Len( oBrw:aCols )
   oBrw:aCols[ n ]:bClrStd := b
next
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10650
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE COLOR ROWS

Postby Otto » Sat Sep 19, 2020 6:36 am

Dear Mr. Rao,
thank you so much for your help.
Have a nice Sunday and best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6344
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 62 guests