Page 1 of 1

How to switch Row-Colors in xBrowse (without Function)

Posted: Wed Mar 26, 2008 1:43 pm
by ukoenig
Hello

There is a easy way to switch row colors
without any function

Code: Select all


// Define alternating row colors 

// Col 1
// ------
oLbx1:aCols[ 1 ]:bClrStd := ;
{|| IIF( AT(".0",  STR( oLbx1:nArrayAt / 2 ) ) > 0, ;
                        {CLR_BLACK, COLOR1}, {CLR_BLACK, COLOR2} ) }

// Col 2
// ------
oLbx1:aCols[ 2 ]:bClrStd := ;
{|| IIF( AT(".0",  STR( oLbx1:nArrayAt / 2 ) ) > 0, ;
                        {CLR_BLACK, COLOR1}, {CLR_BLACK, COLOR2} ) }

Regards

Uwe[/code]

Posted: Wed Mar 26, 2008 2:15 pm
by nageswaragunupudi
Mr ukoenig

It is necessary for us to create a codeblock.

1. It is not necessary to assign bClrStd for each column. It is enough if we assign the codeblock to oBrw:bClrStd. By default, all columns inherit oBrw:bClrStd.

2. Also there is a way which applies to RDD, RecSet, Array or any data source.

The code is :

Code: Select all

oBrw:bClrStd := { || If(  Eval( oBrw:bKeyNo, nil, oBrw ) % 2 == 0, { CLR_BLACK, COLOR1 }, { CLR_BLACK, COLOR2} ) }
This one line of code is enough for all columns and for any datasource, bet it a DBF, Array, RecordSet or whatever.