FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Listbox Row and Column color
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Listbox Row and Column color
Posted: Tue Oct 05, 2010 12:49 AM

Hello,

Can you some provide sample code to set a specific foreground and background color to a LISTBOX row and column based on the data value of that row and column data? I am trying to set row and column colors similar to XLS based on the dynamic data.

I really appreciate any assistance.

Thank you,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Listbox Row and Column color
Posted: Tue Oct 05, 2010 05:46 PM
Darrell

Here is some code to change one LINE background, forground based on the a value in a column :

Code (fw): Select all Collapse
 oBrw:bClrStd := {|| {CLR_BLACK, if( oBrw:oRs:Fields("active"):Value = 'N', RGB(179,203,204), CLR_WHITE ) } }


If you have a fields that can have many results Rao suggested this code to me and it works quite nicely:

Code (fw): Select all Collapse
 oBrw:oCol( "Last Status" ):bClrStd := ;
                 { || HB_Decode( AllTrim( oBrw:oCol("Last Status"):value ), ;
                      "GREEN", { CLR_BLACK, CLR_HGREEN }, ;
                      "YELLOW", { CLR_BLACK, CLR_YELLOW }, ;
                      "RED",    { CLR_WHITE, CLR_HRED } ) }


In the above code the column "Last Status" could be one of three values .. "GREEN", "YELLOW" or "RED" .. using the xHarbour HB_Decode function the code block will return the value of the field and assign your choice of colors to the COLUMN ( only )

Rick Lipkin

Continue the discussion