Page 1 of 1

alternate columns colors

Posted: Mon Jan 09, 2023 12:26 pm
by Silvio.Falconi
coloring alternate rows we can do

oBrw:bClrStd := { || { CLR_BLACK, If( oBrw:KeyNo % 2 == 0, nColor1, nColor2 ) } }

how can we color the columns alternately?


For a sample if I wish colorized only the 4th colomn I made

Code: Select all | Expand


Function Alternate_Columns(nColor1,oBrw)
   local aPos  := { { 1, 4 }, { 2, 4 }, { 3, 4 }, { 4, 4 }, { 5, 4 }, { 6, 4 } }
   local oCol
   local nColor2:=CLR_WHITE

  for each oCol in oBrw:aCols
      oCol:bClrStd   := GenClrBlock( oCol, aPos,nColor1,nColor2 )
   next
   oBrw:refresh()
   return  nil

  static function GenClrBlock( oCol, aPos,nColor1,nColor2 )

   local oBrw  := oCol:oBrw
   local nCol  := oCol:nCreationOrder
   local xCol

   xCol  := nCol // your calculation

return { || If( AScan( aPos, { |a| a[ 1 ] == oBrw:nArrayAt .and. a[ 2 ] == xCol } ) > 0, ;
            { CLR_WHITE, nColor1 }, { CLR_BLACK, nColor2 } ) }
 
how can i not pass a specific column?