Tbrowse with rows in different colors 
Author Message
 Tbrowse with rows in different colors

Hi all
How can I get rows in different colors with tbowse function. This is
possible in FiveWin but in nativ Clipper I can`t make it.
Thanks
Marcin P3atek


Tue, 01 Jul 2003 14:38:22 GMT  
 Tbrowse with rows in different colors
Marcin

oTB := TBrowseDB(1,1,MaxRow(),MaxCol())

oCol := TBColumnNew( 'Field1', { DATA->FIELD1 } )
oCol:ColorBlock    := {|x| IF( oTB:RowPos % 2 = 0, {1,2}, {1,3} }
oTB:addColumn( oCol )

oCol := TBColumnNew( 'Field2', { DATA->FIELD2 } )
oCol:ColorBlock    := {|x| IF( oTB:RowPos % 2 = 0, {1,4}, {1,4} }
oTB:addColumn( oCol )

oCol := TBColumnNew( 'Field3', { DATA->FIELD3 } )
oCol:ColorBlock    := {|x| IF( x > 9, {6,3}, {4,6} }
oTB:addColumn( oCol )

etc...
If your using Clipper 5.3 the returned array should be 4 elements eg.
{1,2,3,4} - Check your NG anyway.

Get the Grumpfish library from the OASIS and look at the demo for an example
of overdoing it.

--
HTH
Steve Quinn
Accept than some days you're the pigeon, and some days you're the statue.
There is no right way to do the wrong thing.
To invent, you need a good imagination and a pile of junk.
                -- Thomas Edison


Quote:
> Hi all
> How can I get rows in different colors with tbowse function. This is
> possible in FiveWin but in nativ Clipper I can`t make it.
> Thanks
> Marcin P3atek



Tue, 01 Jul 2003 14:59:06 GMT  
 Tbrowse with rows in different colors


Quote:
> Hi all
> How can I get rows in different colors with tbowse function. This is
> possible in FiveWin but in nativ Clipper I can`t make it.
> Thanks
> Marcin P3atek

Hi Marcin,
All TbrowseColumn objects contains exported variable named ColorBlock .
ColorBlock contains as optional Codeblock that determines the color of data
items as they are displayed. For example: negative numbers may be displayed
in different color than positive and zero :

oTbrowse:ColorSPec := {'W+/B,W+/R,N/W'}
oTbCol:ColorBlock := {|x|  If (X<0,{1,2},{3,2})

This will display negative number in 'W+/B' and other in 'W+/R'. The cursor
may be in both cases 'N/W'

The returned array contains the n-th colors form Tbrowse:ColorSpec (data and
cursor color). IF you need display one row in the one color, set this
codeblock for each column.

More in NG manual Language->Classes

Regards
Gejza



Fri, 04 Jul 2003 17:54:35 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Row color in Tbrowse

2. alternate row color for every other row in table

3. To assign different colors to different values of a set parameter

4. different bits of text in different colors?

5. TBrowse - Stabilizing the database row with Browse:rowpos.

6. How to control row(), col() while GET within tbrowse

7. TBROWSE did not move the current row

8. TBrowse with 2 rows ?

9. Multiline tbrowse rows

10. Hilighting a row in Tbrowse

11. different choices for Combo Box in Dataset depending on the row

12. Listbox add row to different columns

 

 
Powered by phpBB® Forum Software