Listbox color for a single column

Listbox color for a single column

Postby Rick Lipkin » Thu Jun 12, 2008 12:52 am

To All

I am using the standard TWBrowse ( listbox ) and I want to be able to turn a cell in a row ( column status ) a certain color .. crudely like this

col1 col2 col3 status

xxx xxx xxx RED
xxx xxx xxx GREEN
xxx xxx xxx YELLOW

I can turn the entire row a particular color based on the data in the "status" column .. but turning the entire row a particular color gets too busy... just want to turn the "status" cell in each row a certain color based on the data in that cell.

Any Ideas ??

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Listbox color for a single column

Postby Enrico Maria Giordano » Thu Jun 12, 2008 12:29 pm

Try using nClrPane property:

Code: Select all  Expand view  RUN
oBrw:nClrPane = { | nCol | If( nCol = 1, CLR_HRED, CLR_HGREEN ) }


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Rick Lipkin » Tue Jul 15, 2008 9:57 pm

Enrico

Sorry for the late post .. first chance I have had to get back to this color column issue .. I looked at the samples brwcolor.prg .. however it does not use table fields and it is hard to interpret the array values ..

Here is my code .. I want to look at the last defined column and test for the value of "row_color" = "GREEN" to turn that column green.

The sample code turns the entire row green .. not just the last column .. using standard Twbrowse FWH class ..

Rick Lipkin

//----- Reporting tab

REDEFINE LISTBOX oLBX FIELDS ;
if(oRsRpt:eof, , oRsRpt:Fields("DATE_REPORTED"):Value),;
if(oRsRpt:eof,str(0,4) , str(oRsRpt:Fields("reporting_interval"):Value,4)),;
if(oRsRpt:eof, , oRsRpt:Fields("projmgr"):Value),;
if(oRsRpt:eof, , oRsRpt:Fields("start_date"):Value),;
if(oRsRpt:eof, , oRsRpt:Fields("end_date"):Value),;
if(oRsRpt:eof, , str(oRsRpt:Fields("est_budget"):Value,12,2)),;
if(oRsRpt:eof, , oRsRpt:Fields("final"):Value),;
if(oRsRpt:eof, , oRsRpt:Fields("row_color"):Value), ;
HEADERS "Date Rpt", ;
"Int", ;
"ProjMgr", ;
"StartDt", ;
"EndDt", ;
"EstBudt", ;
"Final", ;
"Status" ;
SIZES 80,40,80,80,80,90,50,70 ;
ID 111 of oFld1:aDialogs[1] ;
ON DBLCLICK( _Rptview(oRsRpt, oRsProj, "V", cPROJECTEID) ,;
oLbx:ReFresh(), ;
oLbx:SetFocus(), SysReFresh() );
UPDATE

IF .not. oRsRpt:eof
oLbx:bLogicLen := { || oRsRpt:RecordCount }
oLbx:bGoTop := { || oRsRpt:MoveFirst() }
oLbx:bGoBottom := { || oRsRpt:MoveLast() }
oLbx:bSkip := { | nSkip | Skipper( oRsRpt, nSkip ) }
oLbx:cAlias := "ARRAY"

oLbx:nClrPane = { | nCOL | if( oRsRpt:Fields("row_color"):Value = "GREEN", CLR_GREEN, CLR_WHITE ) }

ENDIF
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby mmercado » Wed Jul 16, 2008 12:29 am

Rick Lipkin wrote:The sample code turns the entire row green .. not just the last column .. using standard Twbrowse FWH class ..
Hi Rick:

I'm afraid that standard TWBrowse is not a column based browser, then you can't define column or cell colors. That is possible only with TCBrowse or TXBrowse talking about standard FWH browsers.

Regards.

Manuel Mercado.
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Enrico Maria Giordano » Wed Jul 16, 2008 7:15 am

This is not true. From FWH May 2008 whatsnew.txt:

* Enhancement: Class TWBrowse DATA nClrPane if used as a codeblock, now receives a numeric
parameter with the column to be displayed, so you can change the color of a single cell.
Please review samples\BrwColor.prg.


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Wed Jul 16, 2008 7:20 am

Rick Lipkin wrote:The sample code turns the entire row green .. not just the last column .. using standard Twbrowse FWH class ..


It is a bug that I already reported here:

http://forums.fivetechsoft.com/viewtopic.php?t=11385

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Wed Jul 16, 2008 10:10 am

Enrico,

Already fixed! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42110
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Wed Jul 16, 2008 11:09 am

Great, thank you!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8716
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby mmercado » Wed Jul 16, 2008 4:15 pm

Enrico Maria Giordano wrote:This is not true. From FWH May 2008 whatsnew.txt:Enhancement: Class TWBrowse DATA nClrPane if used as a codeblock, now receives a numeric
parameter with the column to be displayed, so you can change the color of a single cell
Sorry :oops: I'm not updated

Best regards.

Manuel Mercado
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby Rick Lipkin » Wed Jul 16, 2008 5:15 pm

Antonio

What was the fix ?? something I can modify on my end ??

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Wed Jul 16, 2008 6:08 pm

Rick,

The fix is explained here:
http://forums.fivetechsoft.com/viewtopic.php?t=11385

Yes, you can easily implement it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42110
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Rick Lipkin » Wed Jul 16, 2008 6:47 pm

Antonio

I made the change in Wbrowse and included it to my compile list .. I had to modify the code block .. here was the fix:

oLbx:nClrPane = { | nCOL | if( (nCOL = 8 .and. oRsRpt:Fields("row_color"):Value = "GREEN"), CLR_GREEN, CLR_WHITE ) }

Thanks
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Wed Jul 16, 2008 8:11 pm

Rick,

Yes, you can implement the codeblock the way you need it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42110
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Rick Lipkin » Wed Jul 16, 2008 11:08 pm

Antonio

You might want to look a nClrText as well .. I have not had a chance to track it down and look in Wbrowse .. I wanted clr_white text on a clr_green background ..

nClrText seems to exibit the same row behavoir and does not seem to respect the cell designation.

Rick LIpkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Thu Jul 17, 2008 8:39 am

Rick,

Fixed, the same n was missing in Eval( nClrTxt, n )

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42110
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

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