FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBROWSE COLOR ROWS
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
XBROWSE COLOR ROWS
Posted: Fri Sep 18, 2020 07: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

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: XBROWSE COLOR ROWS
Posted: Fri Sep 18, 2020 10:41 AM
Dear Otto
This run OK for me ( in ACTION Button )
Code (fw): Select all Collapse
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
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: XBROWSE COLOR ROWS
Posted: 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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBROWSE COLOR ROWS
Posted: Fri Sep 18, 2020 01:48 PM
Mr. Otto

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

Note: bClrStds not bClrStd
Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: XBROWSE COLOR ROWS
Posted: Fri Sep 18, 2020 02:46 PM
Thank You Mr. Rao,

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



Code (fw): Select all Collapse
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



Code (fw): Select all Collapse
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 :-)
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.
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: XBROWSE COLOR ROWS
Posted: Fri Sep 18, 2020 07: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBROWSE COLOR ROWS
Posted: Sat Sep 19, 2020 06:12 AM
Code (fw): Select all Collapse
oBrw:bClrStds := b

is equivalent to
Code (fw): Select all Collapse
for n := 1 to Len( oBrw:aCols )
   oBrw:aCols[ n ]:bClrStd := b
next
Regards



G. N. Rao.

Hyderabad, India
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: XBROWSE COLOR ROWS
Posted: Sat Sep 19, 2020 06:36 AM

Dear Mr. Rao,
thank you so much for your help.
Have a nice Sunday and best regards,
Otto

Continue the discussion