Listbox Row and Column color

Listbox Row and Column color

Postby cdmmaui » 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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Listbox Row and Column color

Postby Rick Lipkin » Tue Oct 05, 2010 5:46 pm

Darrell

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

Code: Select all  Expand view

 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: Select all  Expand view

 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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 33 guests