Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using colorblock

Status
Not open for further replies.

dlpastel

Programmer
Aug 8, 2002
114
US
I am trying to use the colorblock feature to change the color of all columns on a single record or multiple records on my browse screen depending upon the field value of my database field "Area"

I want that if the value of my field "Area" is "A" then all columns for all records with the value "A" are colored in red with white type or if the Area is "B" the columns are in Green with white type.

I appreciate any help.

Thanks,
Dan
 
Hi Dan

the following code worked fine in my application:

LOCAL browse, col := {}
browse:colorSpec := "W/N,W+/G,W+/N,G/W,W+/R,N/N"
AADD(col,TBColumnNew("Number",{||ADB->number}))
col[LEN(col)]:width := 10
col[LEN(col)]:colorBlock := {||IIF(ADB -> Area == "A", ;
{5,5}, {2,2} )}
FOR ii := 1 TO LEN(col)
browse:addColumn(col[ii])
col[ii]:defColor := {1,3}
NEXT

If Area is "A" then the Number is displayed using color W+/R,
in all other cases color W+/G is used.
defColor is setting default colors for unselected and selected,
but this is overwritten by colorBlock.
If multiple colums have to change color, use the same colorblock
for each column.

I hope this helps.

Best regards
Gaby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top