colorize an subarray element

colorize an subarray element

Postby Silvio.Falconi » Fri May 06, 2022 8:16 am

Problem to colorize the subarray of the second column

I have two column on a array but the second is an array

as you can see here

Image

I need to colorize the last 5 element of the second column if are the same of first column

from
oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,3]

to
oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,7]

I made the xbrowse with

Code: Select all  Expand view  RUN
@ 90, 10 XBROWSE  oBrw OF oDlgRitardo  SIZE -10,-80 PIXEL NOBORDER AUTOSORT
      oBrw:SetArray(aData,,,.F.)
      SetupBrowserRit(oBrw)


 proc SetupBrowserRit(oBrw)
     local i

   ADD COLUMN TO oBrw HEADER "Ambo" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,1] } CENTER
   ADD COLUMN TO oBrw HEADER "Ritardo" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,1] } CENTER
   ADD COLUMN TO oBrw HEADER "Estrazione" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,2] } CENTER
   ADD COLUMN TO oBrw HEADER "E1" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,3] } CENTER
   ADD COLUMN TO oBrw HEADER "E2" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,4] } CENTER
   ADD COLUMN TO oBrw HEADER "E3" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,5] } CENTER
   ADD COLUMN TO oBrw HEADER "E4" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,6] } CENTER
   ADD COLUMN TO oBrw HEADER "E5" DATA {|v,oCol| oCol:oBrw:aArrayData[oCol:oBrw:nArrayAt,2,7] } CENTER

    WITH OBJECT oBrw
      // SetGroupHeader( cGrpHdr, nFrom, nUpto, oFont, nAlign )
         :SetGroupHeader( "Estratti",        4,  8 )

      :nRowHeight    := 22
      :nClrBorder := CLR_GRAY

      :lDrawBorder := .t.
      :nColorBox := CLR_HRED
      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
      :lHscroll            := .f.
      :l2007               := .F.
      :l2015               := .f.
      :nStretchCol         := STRETCHCOL_WIDEST
      *:lAllowRowSizing     := .F.
      *:lAllowColSwapping   := .F.
      *:lAllowColHiding     := .F.
      :lRecordSelector     := .F.
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle    := LINESTYLE_NOLINES
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :CreateFromCode()


     FOR i := 1 TO LEN(:aCols)
         oCol := :aCols[ i ]
         oCol:nWidth   := 30
         oCol:bClrStd := ChangeColor( oBrw, i )
           
      NEXT



      :aCols[ 1 ]:nWidth   := 30
      :aCols[ 1 ]:nDataStrAlign   := AL_LEFT
      :aCols[ 2 ]:nWidth   := 30
      :aCols[ 3 ]:nWidth   := 90
      :aCols[ 4 ]:nWidth   := 100

      :SetStyle( 2018 )
   end with

   Return nil
 static function ChangeColor( oBrw, n )
return {|| { CLR_BLACK, ColorCell( oBrw:aRow[ n ]) } }
 


But give me error
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7062
Joined: Thu Oct 18, 2012 7:17 pm

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 78 guests