XBROWSE COLOR ROWS

Post Reply
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

XBROWSE COLOR ROWS

Post by Otto »

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

********************************************************************
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBROWSE COLOR ROWS

Post by cnavarro »

Dear Otto
This run OK for me ( in ACTION Button )

Code: Select all

oBrw1:bClrStd := { || { CLR_WHITE, CLR_BLACK } }
 oBrw1:Refresh()
 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: XBROWSE COLOR ROWS

Post by Otto »

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

********************************************************************
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: XBROWSE COLOR ROWS

Post by nageswaragunupudi »

Mr. Otto

Please try

Code: Select all

oBrw:bClrStds := {||{CLR_WHITE,rgb(240, 173, 78) }}
 
Note: bClrStds not bClrStd
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Re: XBROWSE COLOR ROWS

Post by ukoenig »

Thank You Mr. Rao,

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

Image

Code: Select all

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

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
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: XBROWSE COLOR ROWS

Post by Otto »

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

********************************************************************
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: XBROWSE COLOR ROWS

Post by nageswaragunupudi »

Code: Select all

oBrw:bClrStds := b
 
is equivalent to

Code: Select all

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

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Re: XBROWSE COLOR ROWS

Post by Otto »

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

********************************************************************
Post Reply