FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to define a GROUP-color on xBrw-cells ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

How to define a GROUP-color on xBrw-cells ?

Posted: Mon Mar 20, 2017 12:00 PM
Hello,

I want to define GROUP-colors on the first xBrowse-cell field ("STEUER")->PAT_NUMMER
to sliver the bills of a customer.

sample :
3 bills on customer 1
// color-change
4 bills on customer 2
// color change
1 bill on customer 3



There is still something wrong with the color-change-logic.

Code (fw): Select all Collapse
WITH OBJECT oBrw1
    :aCols[ 1 ]:bClrStd := { || If( nPNr <> ("STEUER")->PAT_NUMMER, ;
                           { If( ( oBrw1:cAlias )->( Deleted() ), 255, aVal[103] ), aVal[102] }, ;
                           { If( ( oBrw1:cAlias )->( Deleted() ), 255, aVal[101] ), aVal[100] } ) }
    :aCols[ 1 ]:bClrSel     :=  ;
    :aCols[ 1 ]:bClrSelFocus    := { || { If( ( oBrw1:cAlias )->( Deleted() ), 255, aVal[105] ), aVal[104] } }
        :bRecSelData        := { |brw| brw:KeyNo }
        :bRecSelHeader  := { |brw| "Nr." }  // or simply "SlNo"
        :bRecSelFooter      := { |brw| brw:nLen } // or Simpy any value
        :nRecSelWidth       := 50
    :MakeTotals()
    :aCols[ 6 ]:bFooter := { || oBrw1:aCols[ 6 ]:nTotal }
    If( nPNr = ("STEUER")->PAT_NUMMER, "", nPNr := ("STEUER")->PAT_NUMMER ) // pat_nummer changed
END
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: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: How to define a GROUP-color on xBrw-cells ?

Posted: Mon Mar 20, 2017 12:18 PM

aColorPairs := { { CLR_BLACK, CLR_WHITE}, { CLR_WHITE, CLR_BLUE }, ........... }
nColorPairs := Len( aColorPairs )

oCol:bClrStd := { || aColorPairs[ VAL( STEUER->PAT_NUMMER ) % nColorPairs + 1 ] }

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to define a GROUP-color on xBrw-cells ?

Posted: Mon Mar 20, 2017 12:46 PM
Mr. Rao,

thank You very much, but it seems there is still something wrong.
I added some more bills to test the color-change.
Number 0004 is painted white.



aColorPairs := { { CLR_BLACK, CLR_WHITE}, { CLR_WHITE, CLR_BLUE } }
nColorPairs := Len( aColorPairs )

WITH OBJECT oBrw1
:aCols[ 1 ]:bClrStd := { || aColorPairs[ VAL( STEUER->PAT_NUMMER ) % nColorPairs + 1 ] }
:bRecSelData := { |brw| brw:KeyNo }
:bRecSelHeader := { |brw| "Nr." } // or simply "SlNo"
:bRecSelFooter := { |brw| brw:nLen } // or Simpy any value
:nRecSelWidth := 50
:MakeTotals()
:aCols[ 6 ]:bFooter := { || oBrw1:aCols[ 6 ]:nTotal }
END

best 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: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: How to define a GROUP-color on xBrw-cells ?

Posted: Mon Mar 20, 2017 12:48 PM

There is nothing wrong.
Define more number of color pairs may be around 10

Regards



G. N. Rao.

Hyderabad, India
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: How to define a GROUP-color on xBrw-cells ?

Posted: Mon Mar 20, 2017 01:16 PM
Once again,
thank You very much.
It works PERFECT now.
I added some more bills for my test.
The solution is needed for a overview of all written bills for the tax consultant.
A customer can have many bills the same time defined with a TYP ( insurance, privat, social welfare office ....)



Code (fw): Select all Collapse
aColorPairs := { { CLR_BLACK, CLR_WHITE}, ;
          { CLR_WHITE, 16711680 }, ; // Blue
          { CLR_WHITE, 255 }, ;   // Red
          { CLR_WHITE, 32768 }, ; // Green
          { CLR_WHITE, 16512 }, ; // Brown
          { CLR_BLACK, 8454143 }, ; // Yellow
          { CLR_BLACK, 16776960 } } // Lightblue

nColorPairs := Len( aColorPairs )

WITH OBJECT oBrw1
     oBrw:bClrStd := { || If( oBrw:KeyNo() % 2 == 0, ; // Row-colors
               { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[103] ), aVal[102] }, ;
               { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[101] ), aVal[100] } ) }
     oBrw:bClrSel :=  ;
     oBrw:bClrSelFocus  := { || { If( ( oBrw:cAlias )->( Deleted() ), 255, aVal[105] ), aVal[104] } }
     :aCols[ 1 ]:bClrStd := { || aColorPairs[ VAL( STEUER->PAT_NUMMER ) % nColorPairs + 1 ] }
     :bRecSelData := { |brw| brw:KeyNo }
     :bRecSelHeader := { |brw| "Nr." }  // or simply "SlNo"
     :bRecSelFooter := { |brw| brw:nLen } // or Simpy any value
     :nRecSelWidth := 50
     :MakeTotals()
     :aCols[ 6 ]:bFooter := { || oBrw1:aCols[ 6 ]:nTotal }
END


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.

Continue the discussion